From 70de1905b375ab0431ebb15e6085919fb051e788 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Mon, 5 Feb 2024 17:54:37 +0000
Subject: [PATCH 01/75] New Adapter: ResetDigital

---
 adapters/resetdigital/resetdigital.go         | 260 ++++++++++++++++++
 adapters/resetdigital/resetdigital_test.go    |  87 ++++++
 .../examplary/simple-banner.json              |  87 ++++++
 openrtb_ext/bidders.go                        |   2 +
 openrtb_ext/imp_resetdigital.go               |   7 +
 5 files changed, 443 insertions(+)
 create mode 100644 adapters/resetdigital/resetdigital.go
 create mode 100644 adapters/resetdigital/resetdigital_test.go
 create mode 100644 adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
 create mode 100644 openrtb_ext/imp_resetdigital.go

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
new file mode 100644
index 00000000000..7e44bfd8607
--- /dev/null
+++ b/adapters/resetdigital/resetdigital.go
@@ -0,0 +1,260 @@
+package resetdigital
+
+import (
+	"encoding/json"
+	"fmt"
+	"net/http"
+	"strconv"
+	"text/template"
+
+	"github.com/prebid/openrtb/v20/openrtb2"
+	"github.com/prebid/prebid-server/v2/adapters"
+	"github.com/prebid/prebid-server/v2/config"
+	"github.com/prebid/prebid-server/v2/openrtb_ext"
+)
+
+// MaximumBids is the maximum number of bids that can be returned by this adapter.
+const (
+	MaxBids = 1
+)
+
+type adapter struct {
+	endpoint    *template.Template
+	endpointUri string
+}
+
+type resetDigitalRequest struct {
+	Site resetDigitalRequestSite  `json:"site"`
+	Imps []resetDigitalRequesImps `json:"imps"`
+}
+
+type resetDigitalRequestSite struct {
+	Domain   string `json:"domain"`
+	Referrer string `json:"referrer"`
+}
+
+type resetDigitalRequesImps struct {
+	ZoneID struct {
+		PlacementID string `json:"placementId"`
+	} `json:"zone_id"`
+	BidID string `json:"bid_id"`
+	ImpID string `json:"imp_id"`
+	Ext   struct {
+		Gpid string `json:"gpid"`
+	} `json:"ext"`
+	Sizes      [][]int64 `json:"sizes"`
+	MediaTypes struct {
+		Banner struct {
+			Sizes [][]int64 `json:"sizes"`
+		} `json:"banner"`
+		Video struct {
+			Sizes [][]int64 `json:"sizes"`
+		} `json:"video"`
+	} `json:"media_types"`
+}
+
+func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) {
+	template, err := template.New("endpointTemplate").Parse(config.Endpoint)
+	if err != nil {
+		return nil, fmt.Errorf("unable to parse endpoint url template: %v", err)
+	}
+
+	bidder := &adapter{
+		endpoint: template,
+	}
+
+	return bidder, nil
+}
+func getHeaders(request *openrtb2.BidRequest) http.Header {
+	headers := http.Header{}
+
+	if request.Device != nil && request.Site != nil {
+		addNonEmptyHeaders(&headers, map[string]string{
+			"Referer":         request.Site.Page,
+			"Accept-Language": request.Device.Language,
+			"User-Agent":      request.Device.UA,
+			"X-Forwarded-For": request.Device.IP,
+			"X-Real-Ip":       request.Device.IP,
+			"Content-Type":    "application/json;charset=utf-8",
+			"Accept":          "application/json",
+		})
+	}
+
+	return headers
+}
+func addNonEmptyHeaders(headers *http.Header, headerValues map[string]string) {
+	for key, value := range headerValues {
+		if len(value) > 0 {
+			headers.Add(key, value)
+		}
+	}
+}
+
+func getReferer(request *openrtb2.BidRequest) string {
+	if request.Site == nil {
+		return ""
+	}
+
+	return request.Site.Domain
+}
+
+func getCurrency(request *openrtb2.BidRequest) string {
+	if len(request.Cur) == 0 {
+		return "USD"
+	}
+
+	return request.Cur[0]
+}
+
+func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {
+	var (
+		requests []*adapters.RequestData
+		errors   []error
+	)
+
+	referer := getReferer(requestData)
+	currency := getCurrency(requestData)
+
+	if referer == currency {
+		return nil, nil
+	}
+
+	for i := range requestData.Imp {
+		imp := requestData.Imp[i]
+		bidType, err := getBidType(imp)
+
+		if err != nil {
+			errors = append(errors, err)
+			continue
+		}
+
+		splittedRequestData := processDataFromRequest(requestData, imp, bidType)
+
+		requestBody, err := json.Marshal(splittedRequestData)
+		if err != nil {
+			errors = append(errors, err)
+			continue
+		}
+
+		requests = append(requests, &adapters.RequestData{
+			Method:  "POST",
+			Uri:     a.endpointUri,
+			Body:    requestBody,
+			Headers: getHeaders(requestData),
+		})
+	}
+
+	return requests, errors
+}
+
+func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp, bidType openrtb_ext.BidType) resetDigitalRequest {
+
+	var resetDigitalRequestData resetDigitalRequest
+	resetDigitalRequestData.Site.Domain = requestData.Site.Domain
+	resetDigitalRequestData.Site.Referrer = requestData.Site.Page
+
+	resetDigitalRequestData.Imps = append(resetDigitalRequestData.Imps, resetDigitalRequesImps{})
+	resetDigitalRequestData.Imps[0].BidID = requestData.ID
+	resetDigitalRequestData.Imps[0].ImpID = imp.ID
+
+	if bidType == openrtb_ext.BidTypeBanner {
+		resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes = append(resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes, []int64{imp.Banner.Format[0].W, imp.Banner.Format[0].H})
+	}
+	if bidType == openrtb_ext.BidTypeVideo {
+		resetDigitalRequestData.Imps[0].MediaTypes.Video.Sizes = append(resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes, []int64{*imp.Video.W, *imp.Video.H})
+	}
+
+	return resetDigitalRequestData
+
+}
+
+func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) {
+	if response.StatusCode == http.StatusNoContent {
+		return nil, nil
+	}
+	if response.StatusCode == http.StatusBadRequest {
+		return nil, []error{fmt.Errorf("bad request")}
+	}
+	if response.StatusCode != http.StatusOK {
+		return nil, []error{fmt.Errorf("unexpected status code: %d", response.StatusCode)}
+	}
+
+	if err := json.Unmarshal(response.Body, &response); err != nil {
+		return nil, []error{err}
+	}
+	bidResponse := adapters.NewBidderResponseWithBidsCapacity(MaxBids)
+	//check no bids
+	jsonData := make(map[string]interface{})
+
+	json.Unmarshal([]byte(response.Body), &jsonData)
+	//Always one bid
+	bid := getBidFromResponse(jsonData)
+
+	bidType, err := getBidType(internalRequest.Imp[0])
+	if err != nil {
+		// handle error
+		return nil, []error{err}
+	}
+	bidResponse.Currency = getCurrency(internalRequest)
+	bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{
+		Bid:     bid,
+		BidType: bidType,
+	})
+
+	return bidResponse, nil
+}
+
+func getBidFromResponse(requestData map[string]interface{}) *openrtb2.Bid {
+	processData := requestData["bids"].([]interface{})[0].(map[string]interface{})
+	fmt.Printf("jsonData: %v\n", processData)
+
+	bid := &openrtb2.Bid{
+		ID:    processData["bid_id"].(string),
+		Price: getBidPrice(processData),
+		ImpID: processData["imp_id"].(string),
+		CrID:  processData["crid"].(string),
+	}
+	//if HTML is filled on jsonData then fill ADM with it
+	if value, ok := processData["html"].(string); ok {
+		bid.AdM = value
+	}
+	//if Width and Height are filled on jsonData then fill W and H with it
+	if value, ok := processData["w"].(string); ok {
+
+		i, _ := strconv.ParseInt(value, 10, 64)
+		if i > 0 {
+			bid.W = i
+		}
+	}
+	if value, ok := processData["h"].(string); ok {
+		i, _ := strconv.ParseInt(value, 10, 64)
+		if i > 0 {
+			bid.H = i
+		}
+	}
+	//if Bid Price is 0 then return nil
+	if bid.Price == 0 {
+		return nil
+	}
+
+	return bid
+}
+
+func getBidPrice(requestData map[string]interface{}) float64 {
+	if value, ok := requestData["cpm"].(float64); ok {
+		return value
+	}
+	return 0.0 // Default value if "cpm" doesn't exist or is not a float64
+}
+
+func getBidType(imp openrtb2.Imp) (openrtb_ext.BidType, error) {
+	if imp.Banner != nil {
+		return openrtb_ext.BidTypeBanner, nil
+	} else if imp.Video != nil {
+		return openrtb_ext.BidTypeVideo, nil
+	} else if imp.Audio != nil {
+		return openrtb_ext.BidTypeAudio, nil
+	}
+
+	return "", fmt.Errorf("failed to find matching imp for bid %s", imp.ID)
+}
diff --git a/adapters/resetdigital/resetdigital_test.go b/adapters/resetdigital/resetdigital_test.go
new file mode 100644
index 00000000000..e3307e916cf
--- /dev/null
+++ b/adapters/resetdigital/resetdigital_test.go
@@ -0,0 +1,87 @@
+package resetdigital
+
+import (
+	"encoding/json"
+	"net/http"
+	"testing"
+
+	"github.com/prebid/openrtb/v20/openrtb2"
+	"github.com/prebid/prebid-server/v2/adapters"
+	"github.com/stretchr/testify/assert"
+)
+
+func TestMakeRequests(t *testing.T) {
+	bidder := new(adapter)
+
+	request := &openrtb2.BidRequest{
+		ID: "12345",
+
+		Imp: []openrtb2.Imp{{
+			ID: "001",
+
+			Banner: &openrtb2.Banner{
+				Format: []openrtb2.Format{
+					{W: 300, H: 250},
+				},
+			},
+			Ext: json.RawMessage(``),
+		}},
+		Site: &openrtb2.Site{
+			Domain: "https://test.com",
+			Page:   "https://test.com/2016/06/12",
+		},
+		Cur: []string{"USD"},
+		Device: &openrtb2.Device{
+			UA:       "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+			IP:       "127.0.0.1",
+			Language: "EN",
+		},
+	}
+
+	reqs, errs := bidder.MakeRequests(request, &adapters.ExtraRequestInfo{})
+
+	assert.Empty(t, errs, "Got unexpected errors while building HTTP requests: %v", errs)
+	assert.Equal(t, 1, len(reqs), "Unexpected number of HTTP requests. Got %d. Expected %d", len(reqs), 1)
+}
+
+func TestMakeBids(t *testing.T) {
+	request := &openrtb2.BidRequest{
+		ID: "test-request-id",
+		Imp: []openrtb2.Imp{{
+			ID: "test-imp-id",
+			Banner: &openrtb2.Banner{
+				Format: []openrtb2.Format{{
+					W: 320,
+					H: 250,
+				}},
+			},
+			Ext: json.RawMessage(`{"bidder": {
+				"accountId": 2763,
+				"siteId": 68780,
+				"zoneId": 327642
+			}}`),
+		}},
+		Ext: json.RawMessage(``),
+	}
+
+	requestJson, _ := json.Marshal(request)
+	reqData := &adapters.RequestData{
+		Method:  "POST",
+		Uri:     "test-uri",
+		Body:    requestJson,
+		Headers: nil,
+	}
+
+	httpResp := &adapters.ResponseData{
+		StatusCode: http.StatusOK,
+		Body:       []byte(`{"bids":[{"bid_id":"01","imp_id":"001","cpm":10.00,"cid":"1002088","crid":"1000763-1002088","adid":"1002088","w":"300","h":"250","seat":"resetdigital","html":"<scriptsrc=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-15&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\"type=\"text/javascript\"></script><imagesrc='https://adsreq.resetdigital.co?brid=0000000000000001'/><imagesrc='https://sync2.resetdigital.co/hbsync?ck=0000000000000001'/>"}]}`),
+	}
+
+	bidder := new(adapter)
+	bidResponse, errs := bidder.MakeBids(request, reqData, httpResp)
+
+	assert.Empty(t, errs, "Expected 0 errors. Got %d", len(errs))
+
+	assert.Equal(t, float64(10), bidResponse.Bids[0].Bid.Price,
+		"Expected Price 10. Got: %s", bidResponse.Bids[0].Bid.Price)
+}
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json b/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
new file mode 100644
index 00000000000..4e21c27015a
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
@@ -0,0 +1,87 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [
+      {
+        "id": "001",
+        "banner": {
+          "w": 300,
+          "h": 250
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "111"
+          }
+        }
+      }
+    ],
+    "site": {
+      "domain": "https://test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "cur": [
+      "USD"
+    ],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [
+    {
+      "language": "en-US",
+      "site": {
+        "domain": "https://test.com",
+        "referrer": "https://test.com/2016/06/12"
+      },
+      "imps": [
+        {
+          "zone_id": {
+            "placementId": "test"
+          },
+          "bid_id": "01",
+          "imp_id": "001",
+          "ext": {
+            "gpid": "test"
+          },
+          "sizes": [
+            [
+              300,
+              250
+            ]
+          ],
+          "media_types": {
+            "banner": {
+              "sizes": [
+                [
+                  300,
+                  250
+                ]
+              ]
+            }
+          }
+        }
+      ]
+    }
+  ],
+  "expectedBidResponses": [
+    {
+      "bids": [
+          {
+              "bid_id": "01",
+              "imp_id": "001",
+              "cpm": 1.00,
+              "cid": "1002088",
+              "crid": "1000763-1002088",
+              "adid": "1002088",
+              "w": "300",
+              "h": "250",
+              "seat": "resetdigital",
+              "html": "<script  />"
+          }
+      ]
+  }
+  ]
+}
\ No newline at end of file
diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go
index 91217f18ce2..dbbb9dcf532 100644
--- a/openrtb_ext/bidders.go
+++ b/openrtb_ext/bidders.go
@@ -161,6 +161,7 @@ var coreBidderNames []BidderName = []BidderName{
 	BidderPulsepoint,
 	BidderPWBid,
 	BidderRelevantDigital,
+	BidderResetDigital,
 	BidderRevcontent,
 	BidderRichaudience,
 	BidderRise,
@@ -440,6 +441,7 @@ const (
 	BidderPulsepoint        BidderName = "pulsepoint"
 	BidderPWBid             BidderName = "pwbid"
 	BidderRelevantDigital   BidderName = "relevantdigital"
+	BidderResetDigital      BidderName = "resetdigital"
 	BidderRevcontent        BidderName = "revcontent"
 	BidderRichaudience      BidderName = "richaudience"
 	BidderRise              BidderName = "rise"
diff --git a/openrtb_ext/imp_resetdigital.go b/openrtb_ext/imp_resetdigital.go
new file mode 100644
index 00000000000..005b524dfb5
--- /dev/null
+++ b/openrtb_ext/imp_resetdigital.go
@@ -0,0 +1,7 @@
+package openrtb_ext
+
+type ExtResetDigital struct {
+	cid  string `json:"bid_id"`
+	crid string `json:"imp_id"`
+	adid string `json:"adid"`
+}

From dd48470b27b58c2b66b153b3a85b9c4d3429d3ea Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Wed, 7 Feb 2024 17:21:56 +0000
Subject: [PATCH 02/75] Fix to have the a bid forced on testing

---
 adapters/resetdigital/resetdigital.go           | 17 ++++++++++++++++-
 adapters/resetdigital/resetdigital_test.go      |  4 ++--
 .../examplary/simple-banner.json                |  3 ++-
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 7e44bfd8607..b3c48506465 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -34,7 +34,8 @@ type resetDigitalRequestSite struct {
 }
 
 type resetDigitalRequesImps struct {
-	ZoneID struct {
+	ForceBid bool `json:"force_bid"`
+	ZoneID   struct {
 		PlacementID string `json:"placementId"`
 	} `json:"zone_id"`
 	BidID string `json:"bid_id"`
@@ -157,6 +158,8 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 	resetDigitalRequestData.Imps[0].BidID = requestData.ID
 	resetDigitalRequestData.Imps[0].ImpID = imp.ID
 
+	var err error
+
 	if bidType == openrtb_ext.BidTypeBanner {
 		resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes = append(resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes, []int64{imp.Banner.Format[0].W, imp.Banner.Format[0].H})
 	}
@@ -164,6 +167,18 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 		resetDigitalRequestData.Imps[0].MediaTypes.Video.Sizes = append(resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes, []int64{*imp.Video.W, *imp.Video.H})
 	}
 
+	var extData = make(map[string]interface{})
+	err = json.Unmarshal(imp.Ext, &extData)
+	if err != nil {
+
+	} else {
+
+		resetDigitalRequestData.Imps[0].ZoneID.PlacementID = extData["bidder"].(map[string]interface{})["placement_id"].(string)
+		if resetDigitalRequestData.Imps[0].ZoneID.PlacementID == "test" {
+			resetDigitalRequestData.Imps[0].ForceBid = true
+		}
+
+	}
 	return resetDigitalRequestData
 
 }
diff --git a/adapters/resetdigital/resetdigital_test.go b/adapters/resetdigital/resetdigital_test.go
index e3307e916cf..22a19dd5865 100644
--- a/adapters/resetdigital/resetdigital_test.go
+++ b/adapters/resetdigital/resetdigital_test.go
@@ -18,13 +18,13 @@ func TestMakeRequests(t *testing.T) {
 
 		Imp: []openrtb2.Imp{{
 			ID: "001",
-
 			Banner: &openrtb2.Banner{
 				Format: []openrtb2.Format{
 					{W: 300, H: 250},
 				},
 			},
-			Ext: json.RawMessage(``),
+
+			Ext: json.RawMessage(`{"bidder": {"placement_id": "test"}}`), //Placement_id test is used to get the force bid true
 		}},
 		Site: &openrtb2.Site{
 			Domain: "https://test.com",
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json b/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
index 4e21c27015a..20e768c675d 100644
--- a/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
+++ b/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
@@ -10,7 +10,7 @@
         },
         "ext": {
           "bidder": {
-            "placement_id": "111"
+            "placement_id": "test"
           }
         }
       }
@@ -38,6 +38,7 @@
       },
       "imps": [
         {
+          "force_bid" : 1,
           "zone_id": {
             "placementId": "test"
           },

From 5c56e1249262281073acf627ae61dfa44c9d7b0e Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Fri, 9 Feb 2024 12:23:22 +0000
Subject: [PATCH 03/75] Test changes

---
 adapters/resetdigital/resetdigital.go      |  5 ++-
 adapters/resetdigital/resetdigital_test.go | 37 ++++++++++++----------
 2 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index b3c48506465..3f359097c7c 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -188,10 +188,10 @@ func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest
 		return nil, nil
 	}
 	if response.StatusCode == http.StatusBadRequest {
-		return nil, []error{fmt.Errorf("bad request")}
+		return nil, nil
 	}
 	if response.StatusCode != http.StatusOK {
-		return nil, []error{fmt.Errorf("unexpected status code: %d", response.StatusCode)}
+		return nil, nil
 	}
 
 	if err := json.Unmarshal(response.Body, &response); err != nil {
@@ -221,7 +221,6 @@ func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest
 
 func getBidFromResponse(requestData map[string]interface{}) *openrtb2.Bid {
 	processData := requestData["bids"].([]interface{})[0].(map[string]interface{})
-	fmt.Printf("jsonData: %v\n", processData)
 
 	bid := &openrtb2.Bid{
 		ID:    processData["bid_id"].(string),
diff --git a/adapters/resetdigital/resetdigital_test.go b/adapters/resetdigital/resetdigital_test.go
index 22a19dd5865..0e31466503a 100644
--- a/adapters/resetdigital/resetdigital_test.go
+++ b/adapters/resetdigital/resetdigital_test.go
@@ -46,30 +46,35 @@ func TestMakeRequests(t *testing.T) {
 
 func TestMakeBids(t *testing.T) {
 	request := &openrtb2.BidRequest{
-		ID: "test-request-id",
+		ID: "12345",
+
 		Imp: []openrtb2.Imp{{
-			ID: "test-imp-id",
+			ID: "001",
 			Banner: &openrtb2.Banner{
-				Format: []openrtb2.Format{{
-					W: 320,
-					H: 250,
-				}},
+				Format: []openrtb2.Format{
+					{W: 300, H: 250},
+				},
 			},
-			Ext: json.RawMessage(`{"bidder": {
-				"accountId": 2763,
-				"siteId": 68780,
-				"zoneId": 327642
-			}}`),
+
+			Ext: json.RawMessage(`{"bidder": {"placement_id": "test"}}`), //Placement_id test is used to get the force bid true
 		}},
-		Ext: json.RawMessage(``),
+		Site: &openrtb2.Site{
+			Domain: "https://test.com",
+			Page:   "https://test.com/2016/06/12",
+		},
+		Cur: []string{"USD"},
+		Device: &openrtb2.Device{
+			UA:       "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+			IP:       "127.0.0.1",
+			Language: "EN",
+		},
 	}
 
 	requestJson, _ := json.Marshal(request)
 	reqData := &adapters.RequestData{
-		Method:  "POST",
-		Uri:     "test-uri",
-		Body:    requestJson,
-		Headers: nil,
+		Method: "POST",
+		Uri:    "test-uri",
+		Body:   requestJson,
 	}
 
 	httpResp := &adapters.ResponseData{

From 20fa8561b759e3f684b502512de8156dad0a6dae Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Wed, 28 Feb 2024 10:28:57 +0000
Subject: [PATCH 04/75] Add file

---
 static/bidder-info/resetdigital.yaml | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 static/bidder-info/resetdigital.yaml

diff --git a/static/bidder-info/resetdigital.yaml b/static/bidder-info/resetdigital.yaml
new file mode 100644
index 00000000000..885916d0d8d
--- /dev/null
+++ b/static/bidder-info/resetdigital.yaml
@@ -0,0 +1,21 @@
+adapters:
+  resetdigital:
+    endpoint: http://b-us-east14.resetdigital.co:9001
+    meta-info:
+      maintainer-email: biddersupport@resetdigital.co
+      app-media-types:
+        - banner
+        - video
+        - audio
+      site-media-types:
+        - banner
+        - video
+        - audio
+      supported-vendors:
+      vendor-id: 1162
+    usersync:
+      cookie-family-name: resetdigital
+      redirect:
+        url: https://sync.resetdigital.co/csync?pid=rubicon&redir={{redirect_url}}
+        support-cors: false
+        uid-macro: '$USER_ID'

From 33f46030341d4eede74339059952d7766bca0bbb Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Wed, 28 Feb 2024 10:46:23 +0000
Subject: [PATCH 05/75] Added schema for adapter

---
 static/bidder-params/resetdigital.json | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 static/bidder-params/resetdigital.json

diff --git a/static/bidder-params/resetdigital.json b/static/bidder-params/resetdigital.json
new file mode 100644
index 00000000000..d52cce3d8fa
--- /dev/null
+++ b/static/bidder-params/resetdigital.json
@@ -0,0 +1,8 @@
+{
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "title": "Relevant Digital Adapter Params",
+    "description": "A schema which validates params accepted by the Relevant Digital adapter",
+    "type": "object",
+    "properties": {},
+    "required": []
+}

From b8ca566e383e9e356ae601201cc6eb13f3d8bb1c Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Mon, 18 Mar 2024 18:00:03 +0000
Subject: [PATCH 06/75] Unused builder removed

---
 adapters/resetdigital/resetdigital.go | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 3f359097c7c..cf068e03d7a 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -9,7 +9,6 @@ import (
 
 	"github.com/prebid/openrtb/v20/openrtb2"
 	"github.com/prebid/prebid-server/v2/adapters"
-	"github.com/prebid/prebid-server/v2/config"
 	"github.com/prebid/prebid-server/v2/openrtb_ext"
 )
 
@@ -54,18 +53,6 @@ type resetDigitalRequesImps struct {
 	} `json:"media_types"`
 }
 
-func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) {
-	template, err := template.New("endpointTemplate").Parse(config.Endpoint)
-	if err != nil {
-		return nil, fmt.Errorf("unable to parse endpoint url template: %v", err)
-	}
-
-	bidder := &adapter{
-		endpoint: template,
-	}
-
-	return bidder, nil
-}
 func getHeaders(request *openrtb2.BidRequest) http.Header {
 	headers := http.Header{}
 

From 2de778168962de80a39c981d2d16563245d57f60 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Sun, 24 Mar 2024 19:28:11 +0000
Subject: [PATCH 07/75] Fix to lack of builder

---
 adapters/resetdigital/resetdigital.go | 13 +++++++++++++
 exchange/adapter_builders.go          |  2 ++
 2 files changed, 15 insertions(+)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index cf068e03d7a..3f359097c7c 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -9,6 +9,7 @@ import (
 
 	"github.com/prebid/openrtb/v20/openrtb2"
 	"github.com/prebid/prebid-server/v2/adapters"
+	"github.com/prebid/prebid-server/v2/config"
 	"github.com/prebid/prebid-server/v2/openrtb_ext"
 )
 
@@ -53,6 +54,18 @@ type resetDigitalRequesImps struct {
 	} `json:"media_types"`
 }
 
+func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) {
+	template, err := template.New("endpointTemplate").Parse(config.Endpoint)
+	if err != nil {
+		return nil, fmt.Errorf("unable to parse endpoint url template: %v", err)
+	}
+
+	bidder := &adapter{
+		endpoint: template,
+	}
+
+	return bidder, nil
+}
 func getHeaders(request *openrtb2.BidRequest) http.Header {
 	headers := http.Header{}
 
diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go
index 57318c006da..342939efc85 100755
--- a/exchange/adapter_builders.go
+++ b/exchange/adapter_builders.go
@@ -144,6 +144,7 @@ import (
 	"github.com/prebid/prebid-server/v2/adapters/pulsepoint"
 	"github.com/prebid/prebid-server/v2/adapters/pwbid"
 	"github.com/prebid/prebid-server/v2/adapters/relevantdigital"
+	"github.com/prebid/prebid-server/v2/adapters/resetdigital"
 	"github.com/prebid/prebid-server/v2/adapters/revcontent"
 	"github.com/prebid/prebid-server/v2/adapters/richaudience"
 	"github.com/prebid/prebid-server/v2/adapters/rise"
@@ -351,6 +352,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder {
 		openrtb_ext.BidderPWBid:             pwbid.Builder,
 		openrtb_ext.BidderRelevantDigital:   relevantdigital.Builder,
 		openrtb_ext.BidderRevcontent:        revcontent.Builder,
+		openrtb_ext.BidderResetDigital:      resetdigital.Builder,
 		openrtb_ext.BidderRichaudience:      richaudience.Builder,
 		openrtb_ext.BidderRise:              rise.Builder,
 		openrtb_ext.BidderRoulax:            roulax.Builder,

From eb067f7a7ceb5693937adb814602e70c1c3647a8 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Tue, 26 Mar 2024 21:40:07 +0000
Subject: [PATCH 08/75] Change of data on export

---
 openrtb_ext/imp_resetdigital.go | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/openrtb_ext/imp_resetdigital.go b/openrtb_ext/imp_resetdigital.go
index 005b524dfb5..b9e2ac8297b 100644
--- a/openrtb_ext/imp_resetdigital.go
+++ b/openrtb_ext/imp_resetdigital.go
@@ -1,7 +1,6 @@
 package openrtb_ext
 
 type ExtResetDigital struct {
-	cid  string `json:"bid_id"`
-	crid string `json:"imp_id"`
-	adid string `json:"adid"`
+	BidID string `json:"bid_id"`
+	ImpID string `json:"imp_id"`
 }

From 86206d77932ebfc20779398a9f3dd999fc1d7cd6 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Sun, 14 Apr 2024 22:35:37 +0100
Subject: [PATCH 09/75] no need to include `required` if its empty

              no need to include `required` if its empty

_Originally posted by @onkarvhanumante in https://github.com/prebid/prebid-server/pull/3452#discussion_r1553484661_
---
 static/bidder-params/resetdigital.json | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/static/bidder-params/resetdigital.json b/static/bidder-params/resetdigital.json
index d52cce3d8fa..d2bcfb6bb5f 100644
--- a/static/bidder-params/resetdigital.json
+++ b/static/bidder-params/resetdigital.json
@@ -3,6 +3,5 @@
     "title": "Relevant Digital Adapter Params",
     "description": "A schema which validates params accepted by the Relevant Digital adapter",
     "type": "object",
-    "properties": {},
-    "required": []
+    "properties": {}
 }

From 3fc545596d2bd09e44b43f0f3a69cce3150a4c2b Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <b.jacinto@gmail.com>
Date: Tue, 14 May 2024 18:27:49 +0100
Subject: [PATCH 10/75] Resolving
 https://github.com/prebid/prebid-server/pull/3452

---
 static/bidder-info/resetdigital.yaml | 2 --
 1 file changed, 2 deletions(-)

diff --git a/static/bidder-info/resetdigital.yaml b/static/bidder-info/resetdigital.yaml
index 885916d0d8d..99c22378318 100644
--- a/static/bidder-info/resetdigital.yaml
+++ b/static/bidder-info/resetdigital.yaml
@@ -1,5 +1,3 @@
-adapters:
-  resetdigital:
     endpoint: http://b-us-east14.resetdigital.co:9001
     meta-info:
       maintainer-email: biddersupport@resetdigital.co

From 989c565f97c46d367d248b73091a68877b4c3f8b Mon Sep 17 00:00:00 2001
From: bruno-sira <bruno@siira.world>
Date: Wed, 3 Jul 2024 14:57:57 +0100
Subject: [PATCH 11/75] New Adapter: ResetDigital #3766

Implementation of suggestions
---
 adapters/resetdigital/resetdigital.go | 93 ++++++++++++++++-----------
 1 file changed, 55 insertions(+), 38 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 3f359097c7c..c2ec6d10b95 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -184,69 +184,67 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 }
 
 func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) {
-	if response.StatusCode == http.StatusNoContent {
-		return nil, nil
-	}
-	if response.StatusCode == http.StatusBadRequest {
-		return nil, nil
-	}
-	if response.StatusCode != http.StatusOK {
+	if response.StatusCode == http.StatusNoContent || response.StatusCode == http.StatusBadRequest || response.StatusCode != http.StatusOK {
 		return nil, nil
 	}
 
-	if err := json.Unmarshal(response.Body, &response); err != nil {
+	var bidResp map[string]interface{}
+	if err := json.Unmarshal(response.Body, &bidResp); err != nil {
 		return nil, []error{err}
 	}
+
 	bidResponse := adapters.NewBidderResponseWithBidsCapacity(MaxBids)
-	//check no bids
-	jsonData := make(map[string]interface{})
+	jsonData := bidResp["bids"].([]interface{})
+
+	for _, bidData := range jsonData {
+		bidMap := bidData.(map[string]interface{})
+		bid := getBidFromResponse(bidMap)
+		if bid == nil {
+			continue
+		}
 
-	json.Unmarshal([]byte(response.Body), &jsonData)
-	//Always one bid
-	bid := getBidFromResponse(jsonData)
+		bidTypes, err := getBidTypes(internalRequest.Imp[0])
+		if err != nil {
+			return nil, []error{err}
+		}
 
-	bidType, err := getBidType(internalRequest.Imp[0])
-	if err != nil {
-		// handle error
-		return nil, []error{err}
+		for _, bidType := range bidTypes {
+			bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{
+				Bid:     bid,
+				BidType: bidType,
+			})
+		}
 	}
-	bidResponse.Currency = getCurrency(internalRequest)
-	bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{
-		Bid:     bid,
-		BidType: bidType,
-	})
 
+	bidResponse.Currency = getCurrency(internalRequest)
 	return bidResponse, nil
 }
-
 func getBidFromResponse(requestData map[string]interface{}) *openrtb2.Bid {
-	processData := requestData["bids"].([]interface{})[0].(map[string]interface{})
+	processData := requestData["bid_id"].(string)
 
 	bid := &openrtb2.Bid{
-		ID:    processData["bid_id"].(string),
-		Price: getBidPrice(processData),
-		ImpID: processData["imp_id"].(string),
-		CrID:  processData["crid"].(string),
+		ID:    processData,
+		Price: getBidPrice(requestData),
+		ImpID: requestData["imp_id"].(string),
+		CrID:  requestData["crid"].(string),
 	}
-	//if HTML is filled on jsonData then fill ADM with it
-	if value, ok := processData["html"].(string); ok {
+
+	if value, ok := requestData["html"].(string); ok {
 		bid.AdM = value
 	}
-	//if Width and Height are filled on jsonData then fill W and H with it
-	if value, ok := processData["w"].(string); ok {
 
-		i, _ := strconv.ParseInt(value, 10, 64)
-		if i > 0 {
+	if value, ok := requestData["w"].(string); ok {
+		if i, err := strconv.ParseInt(value, 10, 64); err == nil && i > 0 {
 			bid.W = i
 		}
 	}
-	if value, ok := processData["h"].(string); ok {
-		i, _ := strconv.ParseInt(value, 10, 64)
-		if i > 0 {
+
+	if value, ok := requestData["h"].(string); ok {
+		if i, err := strconv.ParseInt(value, 10, 64); err == nil && i > 0 {
 			bid.H = i
 		}
 	}
-	//if Bid Price is 0 then return nil
+
 	if bid.Price == 0 {
 		return nil
 	}
@@ -272,3 +270,22 @@ func getBidType(imp openrtb2.Imp) (openrtb_ext.BidType, error) {
 
 	return "", fmt.Errorf("failed to find matching imp for bid %s", imp.ID)
 }
+
+func getBidTypes(imp openrtb2.Imp) ([]openrtb_ext.BidType, error) {
+	var bidTypes []openrtb_ext.BidType
+
+	if imp.Banner != nil {
+		bidTypes = append(bidTypes, openrtb_ext.BidTypeBanner)
+	}
+	if imp.Video != nil {
+		bidTypes = append(bidTypes, openrtb_ext.BidTypeVideo)
+	}
+	if imp.Audio != nil {
+		bidTypes = append(bidTypes, openrtb_ext.BidTypeAudio)
+	}
+	if len(bidTypes) == 0 {
+		return nil, fmt.Errorf("failed to find matching imp for bid %s", imp.ID)
+	}
+
+	return bidTypes, nil
+}
\ No newline at end of file

From 39905edd85c720f49bc79c255f784c942487dbe9 Mon Sep 17 00:00:00 2001
From: bruno-sira <bruno@siira.world>
Date: Fri, 5 Jul 2024 16:56:32 +0100
Subject: [PATCH 12/75] Fix naming

---
 adapters/resetdigital/resetdigital.go | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index c2ec6d10b95..002447a60a3 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -24,8 +24,8 @@ type adapter struct {
 }
 
 type resetDigitalRequest struct {
-	Site resetDigitalRequestSite  `json:"site"`
-	Imps []resetDigitalRequesImps `json:"imps"`
+	Site resetDigitalRequestSite   `json:"site"`
+	Imps []resetDigitalRequestImps `json:"imps"`
 }
 
 type resetDigitalRequestSite struct {
@@ -33,7 +33,7 @@ type resetDigitalRequestSite struct {
 	Referrer string `json:"referrer"`
 }
 
-type resetDigitalRequesImps struct {
+type resetDigitalRequestImps struct {
 	ForceBid bool `json:"force_bid"`
 	ZoneID   struct {
 		PlacementID string `json:"placementId"`
@@ -154,7 +154,7 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 	resetDigitalRequestData.Site.Domain = requestData.Site.Domain
 	resetDigitalRequestData.Site.Referrer = requestData.Site.Page
 
-	resetDigitalRequestData.Imps = append(resetDigitalRequestData.Imps, resetDigitalRequesImps{})
+	resetDigitalRequestData.Imps = append(resetDigitalRequestData.Imps, resetDigitalRequestImps{})
 	resetDigitalRequestData.Imps[0].BidID = requestData.ID
 	resetDigitalRequestData.Imps[0].ImpID = imp.ID
 
@@ -288,4 +288,4 @@ func getBidTypes(imp openrtb2.Imp) ([]openrtb_ext.BidType, error) {
 	}
 
 	return bidTypes, nil
-}
\ No newline at end of file
+}

From 4482bc93108566449cf4c28e3dbe9fc2b12ad37a Mon Sep 17 00:00:00 2001
From: bruno-sira <bruno@siira.world>
Date: Fri, 5 Jul 2024 17:01:01 +0100
Subject: [PATCH 13/75] Fix naming of Var

---
 adapters/resetdigital/resetdigital.go | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 002447a60a3..2f17ef97905 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -14,9 +14,7 @@ import (
 )
 
 // MaximumBids is the maximum number of bids that can be returned by this adapter.
-const (
-	MaxBids = 1
-)
+const maxBids = 1
 
 type adapter struct {
 	endpoint    *template.Template
@@ -193,7 +191,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest
 		return nil, []error{err}
 	}
 
-	bidResponse := adapters.NewBidderResponseWithBidsCapacity(MaxBids)
+	bidResponse := adapters.NewBidderResponseWithBidsCapacity(maxBids)
 	jsonData := bidResp["bids"].([]interface{})
 
 	for _, bidData := range jsonData {

From d426e8a00853fc5e4887964c90f5617d14de0dc9 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Tue, 9 Jul 2024 22:38:23 +0100
Subject: [PATCH 14/75] Fix PR New Adapter: ResetDigital #3766

---
 adapters/resetdigital/resetdigital.go | 36 ++++++++++++++-------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 2f17ef97905..3e6e5db67a0 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -121,13 +121,16 @@ func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *ad
 	for i := range requestData.Imp {
 		imp := requestData.Imp[i]
 		bidType, err := getBidType(imp)
-
 		if err != nil {
 			errors = append(errors, err)
 			continue
 		}
 
-		splittedRequestData := processDataFromRequest(requestData, imp, bidType)
+		splittedRequestData, err := processDataFromRequest(requestData, imp, bidType)
+		if err != nil {
+			errors = append(errors, err)
+			continue
+		}
 
 		requestBody, err := json.Marshal(splittedRequestData)
 		if err != nil {
@@ -146,18 +149,19 @@ func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *ad
 	return requests, errors
 }
 
-func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp, bidType openrtb_ext.BidType) resetDigitalRequest {
-
+func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp, bidType openrtb_ext.BidType) (resetDigitalRequest, error) {
 	var resetDigitalRequestData resetDigitalRequest
-	resetDigitalRequestData.Site.Domain = requestData.Site.Domain
-	resetDigitalRequestData.Site.Referrer = requestData.Site.Page
+
+	// Check if requestData.Site is not nil before accessing its fields
+	if requestData.Site != nil {
+		resetDigitalRequestData.Site.Domain = requestData.Site.Domain
+		resetDigitalRequestData.Site.Referrer = requestData.Site.Page
+	}
 
 	resetDigitalRequestData.Imps = append(resetDigitalRequestData.Imps, resetDigitalRequestImps{})
 	resetDigitalRequestData.Imps[0].BidID = requestData.ID
 	resetDigitalRequestData.Imps[0].ImpID = imp.ID
 
-	var err error
-
 	if bidType == openrtb_ext.BidTypeBanner {
 		resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes = append(resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes, []int64{imp.Banner.Format[0].W, imp.Banner.Format[0].H})
 	}
@@ -166,19 +170,17 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 	}
 
 	var extData = make(map[string]interface{})
-	err = json.Unmarshal(imp.Ext, &extData)
+	err := json.Unmarshal(imp.Ext, &extData)
 	if err != nil {
+		return resetDigitalRequestData, err
+	}
 
-	} else {
-
-		resetDigitalRequestData.Imps[0].ZoneID.PlacementID = extData["bidder"].(map[string]interface{})["placement_id"].(string)
-		if resetDigitalRequestData.Imps[0].ZoneID.PlacementID == "test" {
-			resetDigitalRequestData.Imps[0].ForceBid = true
-		}
-
+	resetDigitalRequestData.Imps[0].ZoneID.PlacementID = extData["bidder"].(map[string]interface{})["placement_id"].(string)
+	if resetDigitalRequestData.Imps[0].ZoneID.PlacementID == "test" {
+		resetDigitalRequestData.Imps[0].ForceBid = true
 	}
-	return resetDigitalRequestData
 
+	return resetDigitalRequestData, nil
 }
 
 func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) {

From ac2fc0188ac75f8b88ad4ea045f34b7c60bc54a9 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Tue, 9 Jul 2024 22:41:31 +0100
Subject: [PATCH 15/75] Fix New Adapter: ResetDigital #3766

---
 adapters/resetdigital/resetdigital.go | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 3e6e5db67a0..fed91b47f05 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -111,13 +111,6 @@ func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *ad
 		errors   []error
 	)
 
-	referer := getReferer(requestData)
-	currency := getCurrency(requestData)
-
-	if referer == currency {
-		return nil, nil
-	}
-
 	for i := range requestData.Imp {
 		imp := requestData.Imp[i]
 		bidType, err := getBidType(imp)

From 52a67946255e2add1a3f0f9e891ca9a2edb992cf Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Tue, 16 Jul 2024 17:10:17 +0100
Subject: [PATCH 16/75] Fix multiple comments

---
 adapters/resetdigital/resetdigital.go | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index fed91b47f05..6d43678eff7 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -151,9 +151,10 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 		resetDigitalRequestData.Site.Referrer = requestData.Site.Page
 	}
 
-	resetDigitalRequestData.Imps = append(resetDigitalRequestData.Imps, resetDigitalRequestImps{})
-	resetDigitalRequestData.Imps[0].BidID = requestData.ID
-	resetDigitalRequestData.Imps[0].ImpID = imp.ID
+	resetDigitalRequestData.Imps = append(resetDigitalRequestData.Imps, resetDigitalRequestImps{
+		BidID: requestData.ID,
+		ImpID: imp.ID,
+	})
 
 	if bidType == openrtb_ext.BidTypeBanner {
 		resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes = append(resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes, []int64{imp.Banner.Format[0].W, imp.Banner.Format[0].H})
@@ -165,7 +166,7 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 	var extData = make(map[string]interface{})
 	err := json.Unmarshal(imp.Ext, &extData)
 	if err != nil {
-		return resetDigitalRequestData, err
+		return resetDigitalRequest{}, err
 	}
 
 	resetDigitalRequestData.Imps[0].ZoneID.PlacementID = extData["bidder"].(map[string]interface{})["placement_id"].(string)

From 9626103356397a1452bb31805a70aed11cb0d8b7 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Thu, 18 Jul 2024 18:07:32 +0100
Subject: [PATCH 17/75] New tests

---
 .../examplary/test-missing-cur.json           |  86 +++++++++++++
 .../examplary/test-missing-site.json          |  64 ++++++++++
 .../examplary/test-multi-format.json          | 119 ++++++++++++++++++
 .../examplary/test-request-error.json         |  74 +++++++++++
 4 files changed, 343 insertions(+)
 create mode 100644 adapters/resetdigital/resetdigitaltest/examplary/test-missing-cur.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/examplary/test-missing-site.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/examplary/test-multi-format.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/examplary/test-request-error.json

diff --git a/adapters/resetdigital/resetdigitaltest/examplary/test-missing-cur.json b/adapters/resetdigital/resetdigitaltest/examplary/test-missing-cur.json
new file mode 100644
index 00000000000..5b997219cc6
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/examplary/test-missing-cur.json
@@ -0,0 +1,86 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [
+      {
+        "id": "001",
+        "banner": {
+          "w": 300,
+          "h": 250
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "test"
+          }
+        }
+      }
+    ],
+    "site": {
+      "domain": "https://test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "cur": [],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [
+    {
+      "language": "en-US",
+      "site": {
+        "domain": "https://test.com",
+        "referrer": "https://test.com/2016/06/12"
+      },
+      "imps": [
+        {
+          "force_bid": 1,
+          "zone_id": {
+            "placementId": "test"
+          },
+          "bid_id": "01",
+          "imp_id": "001",
+          "ext": {
+            "gpid": "test"
+          },
+          "sizes": [
+            [
+              300,
+              250
+            ]
+          ],
+          "media_types": {
+            "banner": {
+              "sizes": [
+                [
+                  300,
+                  250
+                ]
+              ]
+            }
+          }
+        }
+      ]
+    }
+  ],
+  "expectedBidResponses": [
+    {
+      "bids": [
+        {
+          "bid_id": "01",
+          "imp_id": "001",
+          "cpm": 1.0,
+          "cid": "1002088",
+          "crid": "1000763-1002088",
+          "adid": "1002088",
+          "w": "300",
+          "h": "250",
+          "seat": "resetdigital",
+          "html": "<script  />"
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/test-missing-site.json b/adapters/resetdigital/resetdigitaltest/examplary/test-missing-site.json
new file mode 100644
index 00000000000..84660ad96b8
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/examplary/test-missing-site.json
@@ -0,0 +1,64 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [
+      {
+        "id": "001",
+        "banner": {
+          "w": 300,
+          "h": 250
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "test"
+          }
+        }
+      }
+    ],
+    "cur": [
+      "USD"
+    ],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [
+    {
+      "language": "en-US",
+      "site": {},
+      "imps": [
+        {
+          "force_bid": 1,
+          "zone_id": {
+            "placementId": "test"
+          },
+          "bid_id": "01",
+          "imp_id": "001",
+          "ext": {
+            "gpid": "test"
+          },
+          "sizes": [
+            [
+              300,
+              250
+            ]
+          ],
+          "media_types": {
+            "banner": {
+              "sizes": [
+                [
+                  300,
+                  250
+                ]
+              ]
+            }
+          }
+        }
+      ]
+    }
+  ],
+  "expectedBidResponses": []
+}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/test-multi-format.json b/adapters/resetdigital/resetdigitaltest/examplary/test-multi-format.json
new file mode 100644
index 00000000000..c0278301bc0
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/examplary/test-multi-format.json
@@ -0,0 +1,119 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [
+      {
+        "id": "001",
+        "banner": {
+          "w": 300,
+          "h": 250
+        },
+        "video": {
+          "mimes": [
+            "video/mp4"
+          ],
+          "minduration": 5,
+          "maxduration": 60,
+          "protocols": [
+            2,
+            3
+          ],
+          "w": 640,
+          "h": 480
+        },
+        "audio": {
+          "mimes": [
+            "audio/mp3"
+          ],
+          "minduration": 5,
+          "maxduration": 60
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "test"
+          }
+        }
+      }
+    ],
+    "site": {
+      "domain": "https://test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "cur": [
+      "USD"
+    ],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [
+    {
+      "language": "en-US",
+      "site": {
+        "domain": "https://test.com",
+        "referrer": "https://test.com/2016/06/12"
+      },
+      "imps": [
+        {
+          "force_bid": 1,
+          "zone_id": {
+            "placementId": "test"
+          },
+          "bid_id": "01",
+          "imp_id": "001",
+          "ext": {
+            "gpid": "test"
+          },
+          "sizes": [
+            [
+              300,
+              250
+            ]
+          ],
+          "media_types": {
+            "banner": {
+              "sizes": [
+                [
+                  300,
+                  250
+                ]
+              ]
+            },
+            "video": {
+              "sizes": [
+                [
+                  640,
+                  480
+                ]
+              ]
+            },
+            "audio": {
+              "sizes": []
+            }
+          }
+        }
+      ]
+    }
+  ],
+  "expectedBidResponses": [
+    {
+      "bids": [
+        {
+          "bid_id": "01",
+          "imp_id": "001",
+          "cpm": 1.0,
+          "cid": "1002088",
+          "crid": "1000763-1002088",
+          "adid": "1002088",
+          "w": "300",
+          "h": "250",
+          "seat": "resetdigital",
+          "html": "<script  />"
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/test-request-error.json b/adapters/resetdigital/resetdigitaltest/examplary/test-request-error.json
new file mode 100644
index 00000000000..11c17e8e36d
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/examplary/test-request-error.json
@@ -0,0 +1,74 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [
+      {
+        "id": "001",
+        "banner": {
+          "w": 300,
+          "h": 250
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "test"
+          }
+        }
+      }
+    ],
+    "site": {
+      "domain": "https://test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "cur": [
+      "USD"
+    ],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [
+    {
+      "language": "en-US",
+      "site": {
+        "domain": "https://test.com",
+        "referrer": "https://test.com/2016/06/12"
+      },
+      "imps": [
+        {
+          "force_bid": 1,
+          "zone_id": {
+            "placementId": "test"
+          },
+          "bid_id": "01",
+          "imp_id": "001",
+          "ext": {
+            "gpid": "test"
+          },
+          "sizes": [
+            [
+              300,
+              250
+            ]
+          ],
+          "media_types": {
+            "banner": {
+              "sizes": [
+                [
+                  300,
+                  250
+                ]
+              ]
+            }
+          }
+        }
+      ]
+    }
+  ],
+  "expectedBidResponses": [],
+  "errors": [
+    "Error in request processing"
+  ]
+}
\ No newline at end of file

From dea6cf703ca30911c5e5c50b72da06cf6f3e2fd3 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Thu, 25 Jul 2024 00:19:54 +0100
Subject: [PATCH 18/75] Fix http.StatusBadRequest and non http.StatusOK codes
 should not be excluded. Can be rewritten as below:

---
 adapters/resetdigital/resetdigital.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 6d43678eff7..6842ba2a0a2 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -178,10 +178,14 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 }
 
 func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) {
-	if response.StatusCode == http.StatusNoContent || response.StatusCode == http.StatusBadRequest || response.StatusCode != http.StatusOK {
+	if adapters.IsResponseStatusCodeNoContent(response) {
 		return nil, nil
 	}
 
+	if err := adapters.CheckResponseStatusCodeForErrors(response); err != nil {
+		return nil, []error{err}
+	}
+
 	var bidResp map[string]interface{}
 	if err := json.Unmarshal(response.Body, &bidResp); err != nil {
 		return nil, []error{err}

From 5cfe0ae96915550703e8369cefa799fb987c08a0 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Fri, 16 Aug 2024 15:57:25 +0100
Subject: [PATCH 19/75] Not running tests at this momment

---
 adapters/resetdigital/resetdigital.go         |  42 ++++---
 adapters/resetdigital/resetdigital_test.go    |  15 +++
 .../examplary/simple-banner.json              |  88 --------------
 .../exemplary/simple-banner.json              | 109 ++++++++++++++++++
 4 files changed, 152 insertions(+), 102 deletions(-)
 delete mode 100644 adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 6842ba2a0a2..5d44ac092d2 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -89,14 +89,6 @@ func addNonEmptyHeaders(headers *http.Header, headerValues map[string]string) {
 	}
 }
 
-func getReferer(request *openrtb2.BidRequest) string {
-	if request.Site == nil {
-		return ""
-	}
-
-	return request.Site.Domain
-}
-
 func getCurrency(request *openrtb2.BidRequest) string {
 	if len(request.Cur) == 0 {
 		return "USD"
@@ -113,6 +105,7 @@ func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *ad
 
 	for i := range requestData.Imp {
 		imp := requestData.Imp[i]
+
 		bidType, err := getBidType(imp)
 		if err != nil {
 			errors = append(errors, err)
@@ -136,8 +129,10 @@ func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *ad
 			Uri:     a.endpointUri,
 			Body:    requestBody,
 			Headers: getHeaders(requestData),
+			ImpIDs:  []string{imp.ID},
 		})
 	}
+	//clear requests.body
 
 	return requests, errors
 }
@@ -149,6 +144,7 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 	if requestData.Site != nil {
 		resetDigitalRequestData.Site.Domain = requestData.Site.Domain
 		resetDigitalRequestData.Site.Referrer = requestData.Site.Page
+
 	}
 
 	resetDigitalRequestData.Imps = append(resetDigitalRequestData.Imps, resetDigitalRequestImps{
@@ -157,12 +153,33 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 	})
 
 	if bidType == openrtb_ext.BidTypeBanner {
-		resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes = append(resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes, []int64{imp.Banner.Format[0].W, imp.Banner.Format[0].H})
+		if imp.Banner != nil {
+			var tempH int64 = *imp.Banner.H
+			var tempW int64 = *imp.Banner.W
+
+			if tempH > 0 && tempW > 0 {
+				resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes = append(
+					resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes,
+					[]int64{tempH, tempW},
+				)
+			}
+
+		}
 	}
+
 	if bidType == openrtb_ext.BidTypeVideo {
-		resetDigitalRequestData.Imps[0].MediaTypes.Video.Sizes = append(resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes, []int64{*imp.Video.W, *imp.Video.H})
+		if imp.Video != nil {
+			var tempH int64 = *imp.Video.H
+			var tempW int64 = *imp.Video.W
+
+			if tempH > 0 && tempW > 0 {
+				resetDigitalRequestData.Imps[0].MediaTypes.Video.Sizes = append(
+					resetDigitalRequestData.Imps[0].MediaTypes.Video.Sizes,
+					[]int64{tempH, tempW},
+				)
+			}
+		}
 	}
-
 	var extData = make(map[string]interface{})
 	err := json.Unmarshal(imp.Ext, &extData)
 	if err != nil {
@@ -170,9 +187,6 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 	}
 
 	resetDigitalRequestData.Imps[0].ZoneID.PlacementID = extData["bidder"].(map[string]interface{})["placement_id"].(string)
-	if resetDigitalRequestData.Imps[0].ZoneID.PlacementID == "test" {
-		resetDigitalRequestData.Imps[0].ForceBid = true
-	}
 
 	return resetDigitalRequestData, nil
 }
diff --git a/adapters/resetdigital/resetdigital_test.go b/adapters/resetdigital/resetdigital_test.go
index 0e31466503a..12f2dc09e17 100644
--- a/adapters/resetdigital/resetdigital_test.go
+++ b/adapters/resetdigital/resetdigital_test.go
@@ -7,9 +7,24 @@ import (
 
 	"github.com/prebid/openrtb/v20/openrtb2"
 	"github.com/prebid/prebid-server/v2/adapters"
+	"github.com/prebid/prebid-server/v2/adapters/adapterstest"
+	"github.com/prebid/prebid-server/v2/config"
+	"github.com/prebid/prebid-server/v2/openrtb_ext"
 	"github.com/stretchr/testify/assert"
 )
 
+func TestJsonSamples(t *testing.T) {
+
+	bidder, buildErr := Builder(openrtb_ext.BidderResetDigital, config.Adapter{
+		Endpoint: "https://test.com"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})
+
+	if buildErr != nil {
+		t.Fatalf("Builder returned unexpected error %v", buildErr)
+	}
+
+	adapterstest.RunJSONBidderTest(t, "resetdigitaltest", bidder)
+}
+
 func TestMakeRequests(t *testing.T) {
 	bidder := new(adapter)
 
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json b/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
deleted file mode 100644
index 20e768c675d..00000000000
--- a/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
+++ /dev/null
@@ -1,88 +0,0 @@
-{
-  "mockBidRequest": {
-    "id": "12345",
-    "imp": [
-      {
-        "id": "001",
-        "banner": {
-          "w": 300,
-          "h": 250
-        },
-        "ext": {
-          "bidder": {
-            "placement_id": "test"
-          }
-        }
-      }
-    ],
-    "site": {
-      "domain": "https://test.com",
-      "page": "https://test.com/2016/06/12"
-    },
-    "cur": [
-      "USD"
-    ],
-    "device": {
-      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
-      "ip": "127.0.0.1",
-      "language": "EN"
-    },
-    "tmax": 500
-  },
-  "httpCalls": [
-    {
-      "language": "en-US",
-      "site": {
-        "domain": "https://test.com",
-        "referrer": "https://test.com/2016/06/12"
-      },
-      "imps": [
-        {
-          "force_bid" : 1,
-          "zone_id": {
-            "placementId": "test"
-          },
-          "bid_id": "01",
-          "imp_id": "001",
-          "ext": {
-            "gpid": "test"
-          },
-          "sizes": [
-            [
-              300,
-              250
-            ]
-          ],
-          "media_types": {
-            "banner": {
-              "sizes": [
-                [
-                  300,
-                  250
-                ]
-              ]
-            }
-          }
-        }
-      ]
-    }
-  ],
-  "expectedBidResponses": [
-    {
-      "bids": [
-          {
-              "bid_id": "01",
-              "imp_id": "001",
-              "cpm": 1.00,
-              "cid": "1002088",
-              "crid": "1000763-1002088",
-              "adid": "1002088",
-              "w": "300",
-              "h": "250",
-              "seat": "resetdigital",
-              "html": "<script  />"
-          }
-      ]
-  }
-  ]
-}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
new file mode 100644
index 00000000000..8d4e0adb1d0
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
@@ -0,0 +1,109 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [
+      {
+        "id": "001",
+        "banner": {
+          "w": 300,
+          "h": 250
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "test"
+          }
+        }
+      }
+    ],
+    "site": {
+      "domain": "test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "cur": [
+      "USD"
+    ],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [
+    {
+      "expectedRequest": {
+        "method": "POST",
+        "body": {
+          "id": "12345",
+          "imp": [
+            {
+              "id": "001",
+              "banner": {
+                "w": 300,
+                "h": 250
+              },
+              "ext": {
+                "bidder": {
+                  "placement_id": "test"
+                }
+              }
+            }
+          ],
+          "site": {
+            "domain": "test.com",
+            "page": "https://test.com/2016/06/12"
+          },
+          "cur": [
+            "USD"
+          ],
+          "device": {
+            "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+            "ip": "127.0.0.1",
+            "language": "EN"
+          },
+          "tmax": 500
+        },
+        "impIDs": [
+          "001"
+        ]
+      },
+      "mockResponse": {
+        "status": 200,
+        "body": {
+          "bids": [
+            {
+              "bid_id": "01",
+              "imp_id": "001",
+              "cpm": 1.00,
+              "cid": "1002088",
+              "crid": "1000763-1002088",
+              "adid": "1002088",
+              "w": "300",
+              "h": "250",
+              "seat": "resetdigital",
+              "html": "<script></script>"
+            }
+          ]
+        }
+      }
+    }
+  ],
+  "expectedBidResponses": [
+    {
+      "bids": [
+        {
+          "bid_id": "01",
+          "imp_id": "001",
+          "cpm": 1.00,
+          "cid": "1002088",
+          "crid": "1000763-1002088",
+          "adid": "1002088",
+          "w": "300",
+          "h": "250",
+          "seat": "resetdigital",
+          "html": "<script></script>"
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file

From ece8152439a05b6625e27b25e81e3ba9573f3647 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Thu, 29 Aug 2024 15:52:32 +0100
Subject: [PATCH 20/75] Update with help of Xandr Team

---
 adapters/resetdigital/resetdigital.go         | 244 +++++++++---------
 .../exemplary/simple-banner.json              | 150 ++++++-----
 openrtb_ext/imp_resetdigital.go               |   5 +-
 3 files changed, 198 insertions(+), 201 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 5d44ac092d2..bca84364e8c 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -22,34 +22,49 @@ type adapter struct {
 }
 
 type resetDigitalRequest struct {
-	Site resetDigitalRequestSite   `json:"site"`
-	Imps []resetDigitalRequestImps `json:"imps"`
+	Site resetDigitalSite  `json:"site"`
+	Imps []resetDigitalImp `json:"imps"`
 }
-
-type resetDigitalRequestSite struct {
+type resetDigitalSite struct {
 	Domain   string `json:"domain"`
 	Referrer string `json:"referrer"`
 }
+type resetDigitalImp struct {
+	ForceBid   bool                   `json:"force_bid"`
+	ZoneID     resetDigitalImpZone    `json:"zone_id"`
+	BidID      string                 `json:"bid_id"`
+	ImpID      string                 `json:"imp_id"`
+	Ext        resetDigitalImpExt     `json:"ext"`
+	MediaTypes resetDigitalMediaTypes `json:"media_types"`
+}
+type resetDigitalImpZone struct {
+	PlacementID string `json:"placementId"`
+}
+type resetDigitalImpExt struct {
+	Gpid string `json:"gpid"`
+}
+type resetDigitalMediaTypes struct {
+	Banner resetDigitalMediaType `json:"banner"`
+	Video  resetDigitalMediaType `json:"video"`
+}
+type resetDigitalMediaType struct {
+	Sizes [][]int64 `json:"sizes"`
+}
 
-type resetDigitalRequestImps struct {
-	ForceBid bool `json:"force_bid"`
-	ZoneID   struct {
-		PlacementID string `json:"placementId"`
-	} `json:"zone_id"`
-	BidID string `json:"bid_id"`
-	ImpID string `json:"imp_id"`
-	Ext   struct {
-		Gpid string `json:"gpid"`
-	} `json:"ext"`
-	Sizes      [][]int64 `json:"sizes"`
-	MediaTypes struct {
-		Banner struct {
-			Sizes [][]int64 `json:"sizes"`
-		} `json:"banner"`
-		Video struct {
-			Sizes [][]int64 `json:"sizes"`
-		} `json:"video"`
-	} `json:"media_types"`
+type resetDigitalBidResponse struct {
+	Bids []resetDigitalBid `json:"bids"`
+}
+type resetDigitalBid struct {
+	BidID string  `json:"bid_id"`
+	ImpID string  `json:"imp_id"`
+	CPM   float64 `json:"cpm"`
+	CID   string  `json:"cid,omitempty"`
+	CrID  string  `json:"crid,omitempty"`
+	AdID  string  `json:"adid"`
+	W     string  `json:"w,omitempty"`
+	H     string  `json:"h,omitempty"`
+	Seat  string  `json:"seat"`
+	HTML  string  `json:"html"`
 }
 
 func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) {
@@ -57,17 +72,16 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co
 	if err != nil {
 		return nil, fmt.Errorf("unable to parse endpoint url template: %v", err)
 	}
-
 	bidder := &adapter{
 		endpoint: template,
 	}
-
 	return bidder, nil
 }
+
 func getHeaders(request *openrtb2.BidRequest) http.Header {
 	headers := http.Header{}
 
-	if request.Device != nil && request.Site != nil {
+	if request != nil && request.Device != nil && request.Site != nil {
 		addNonEmptyHeaders(&headers, map[string]string{
 			"Referer":         request.Site.Page,
 			"Accept-Language": request.Device.Language,
@@ -78,9 +92,9 @@ func getHeaders(request *openrtb2.BidRequest) http.Header {
 			"Accept":          "application/json",
 		})
 	}
-
 	return headers
 }
+
 func addNonEmptyHeaders(headers *http.Header, headerValues map[string]string) {
 	for key, value := range headerValues {
 		if len(value) > 0 {
@@ -89,23 +103,13 @@ func addNonEmptyHeaders(headers *http.Header, headerValues map[string]string) {
 	}
 }
 
-func getCurrency(request *openrtb2.BidRequest) string {
-	if len(request.Cur) == 0 {
-		return "USD"
-	}
-
-	return request.Cur[0]
-}
-
 func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {
 	var (
 		requests []*adapters.RequestData
 		errors   []error
 	)
 
-	for i := range requestData.Imp {
-		imp := requestData.Imp[i]
-
+	for _, imp := range requestData.Imp {
 		bidType, err := getBidType(imp)
 		if err != nil {
 			errors = append(errors, err)
@@ -132,145 +136,133 @@ func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *ad
 			ImpIDs:  []string{imp.ID},
 		})
 	}
-	//clear requests.body
 
 	return requests, errors
 }
 
 func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp, bidType openrtb_ext.BidType) (resetDigitalRequest, error) {
-	var resetDigitalRequestData resetDigitalRequest
+	var reqData resetDigitalRequest
 
-	// Check if requestData.Site is not nil before accessing its fields
 	if requestData.Site != nil {
-		resetDigitalRequestData.Site.Domain = requestData.Site.Domain
-		resetDigitalRequestData.Site.Referrer = requestData.Site.Page
-
+		reqData.Site.Domain = requestData.Site.Domain
+		reqData.Site.Referrer = requestData.Site.Page
 	}
 
-	resetDigitalRequestData.Imps = append(resetDigitalRequestData.Imps, resetDigitalRequestImps{
+	reqData.Imps = append(reqData.Imps, resetDigitalImp{
 		BidID: requestData.ID,
 		ImpID: imp.ID,
 	})
 
-	if bidType == openrtb_ext.BidTypeBanner {
-		if imp.Banner != nil {
-			var tempH int64 = *imp.Banner.H
-			var tempW int64 = *imp.Banner.W
-
-			if tempH > 0 && tempW > 0 {
-				resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes = append(
-					resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes,
-					[]int64{tempH, tempW},
-				)
-			}
+	if bidType == openrtb_ext.BidTypeBanner && imp.Banner != nil {
+		tempH := *imp.Banner.H
+		tempW := *imp.Banner.W
 
+		if tempH > 0 && tempW > 0 {
+			reqData.Imps[0].MediaTypes.Banner.Sizes = append(
+				reqData.Imps[0].MediaTypes.Banner.Sizes,
+				[]int64{tempH, tempW},
+			)
 		}
 	}
-
-	if bidType == openrtb_ext.BidTypeVideo {
-		if imp.Video != nil {
-			var tempH int64 = *imp.Video.H
-			var tempW int64 = *imp.Video.W
-
-			if tempH > 0 && tempW > 0 {
-				resetDigitalRequestData.Imps[0].MediaTypes.Video.Sizes = append(
-					resetDigitalRequestData.Imps[0].MediaTypes.Video.Sizes,
-					[]int64{tempH, tempW},
-				)
-			}
+	if bidType == openrtb_ext.BidTypeVideo && imp.Video != nil {
+		tempH := *imp.Video.H
+		tempW := *imp.Video.W
+
+		if tempH > 0 && tempW > 0 {
+			reqData.Imps[0].MediaTypes.Video.Sizes = append(
+				reqData.Imps[0].MediaTypes.Video.Sizes,
+				[]int64{tempH, tempW},
+			)
 		}
 	}
-	var extData = make(map[string]interface{})
-	err := json.Unmarshal(imp.Ext, &extData)
-	if err != nil {
+
+	var bidderExt adapters.ExtImpBidder
+	var resetDigitalExt openrtb_ext.ImpExtResetDigital
+
+	if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil {
 		return resetDigitalRequest{}, err
 	}
+	if err := json.Unmarshal(bidderExt.Bidder, &resetDigitalExt); err != nil {
+		return resetDigitalRequest{}, err
+	}
+	reqData.Imps[0].ZoneID.PlacementID = resetDigitalExt.PlacementID
 
-	resetDigitalRequestData.Imps[0].ZoneID.PlacementID = extData["bidder"].(map[string]interface{})["placement_id"].(string)
-
-	return resetDigitalRequestData, nil
+	return reqData, nil
 }
 
-func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) {
-	if adapters.IsResponseStatusCodeNoContent(response) {
+func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) {
+	if adapters.IsResponseStatusCodeNoContent(responseData) {
 		return nil, nil
 	}
 
-	if err := adapters.CheckResponseStatusCodeForErrors(response); err != nil {
+	if err := adapters.CheckResponseStatusCodeForErrors(responseData); err != nil {
 		return nil, []error{err}
 	}
 
-	var bidResp map[string]interface{}
-	if err := json.Unmarshal(response.Body, &bidResp); err != nil {
+	var response resetDigitalBidResponse
+	if err := json.Unmarshal(responseData.Body, &response); err != nil {
 		return nil, []error{err}
 	}
 
-	bidResponse := adapters.NewBidderResponseWithBidsCapacity(maxBids)
-	jsonData := bidResp["bids"].([]interface{})
+	bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp))
+
+	requestImps := make(map[string]openrtb2.Imp)
+	for _, imp := range request.Imp {
+		requestImps[imp.ID] = imp
+	}
 
-	for _, bidData := range jsonData {
-		bidMap := bidData.(map[string]interface{})
-		bid := getBidFromResponse(bidMap)
+	for i := range response.Bids {
+		resetDigitalBid := &response.Bids[i]
+
+		bid := getBidFromResponse(resetDigitalBid)
 		if bid == nil {
 			continue
 		}
 
-		bidTypes, err := getBidTypes(internalRequest.Imp[0])
+		bidType, err := GetMediaTypeForImp(requestImps, bid.ImpID)
 		if err != nil {
 			return nil, []error{err}
 		}
 
-		for _, bidType := range bidTypes {
-			bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{
-				Bid:     bid,
-				BidType: bidType,
-			})
+		b := &adapters.TypedBid{
+			Bid:     bid,
+			BidType: bidType,
+			Seat:    openrtb_ext.BidderName(resetDigitalBid.Seat),
 		}
+		bidResponse.Bids = append(bidResponse.Bids, b)
+	}
+
+	if len(request.Cur) == 0 {
+		bidResponse.Currency = "USD"
 	}
 
-	bidResponse.Currency = getCurrency(internalRequest)
 	return bidResponse, nil
 }
-func getBidFromResponse(requestData map[string]interface{}) *openrtb2.Bid {
-	processData := requestData["bid_id"].(string)
-
-	bid := &openrtb2.Bid{
-		ID:    processData,
-		Price: getBidPrice(requestData),
-		ImpID: requestData["imp_id"].(string),
-		CrID:  requestData["crid"].(string),
-	}
 
-	if value, ok := requestData["html"].(string); ok {
-		bid.AdM = value
+func getBidFromResponse(bidResponse *resetDigitalBid) *openrtb2.Bid {
+	if bidResponse.CPM == 0 {
+		return nil
 	}
 
-	if value, ok := requestData["w"].(string); ok {
-		if i, err := strconv.ParseInt(value, 10, 64); err == nil && i > 0 {
-			bid.W = i
-		}
+	bid := &openrtb2.Bid{
+		ID:    bidResponse.BidID,
+		Price: bidResponse.CPM,
+		ImpID: bidResponse.ImpID,
+		CID:   bidResponse.CID,
+		CrID:  bidResponse.CrID,
+		AdM:   bidResponse.HTML,
 	}
 
-	if value, ok := requestData["h"].(string); ok {
-		if i, err := strconv.ParseInt(value, 10, 64); err == nil && i > 0 {
-			bid.H = i
-		}
+	if i, err := strconv.ParseInt(bidResponse.W, 10, 64); err == nil && i > 0 {
+		bid.W = i
 	}
-
-	if bid.Price == 0 {
-		return nil
+	if i, err := strconv.ParseInt(bidResponse.H, 10, 64); err == nil && i > 0 {
+		bid.H = i
 	}
 
 	return bid
 }
 
-func getBidPrice(requestData map[string]interface{}) float64 {
-	if value, ok := requestData["cpm"].(float64); ok {
-		return value
-	}
-	return 0.0 // Default value if "cpm" doesn't exist or is not a float64
-}
-
 func getBidType(imp openrtb2.Imp) (openrtb_ext.BidType, error) {
 	if imp.Banner != nil {
 		return openrtb_ext.BidTypeBanner, nil
@@ -301,3 +293,15 @@ func getBidTypes(imp openrtb2.Imp) ([]openrtb_ext.BidType, error) {
 
 	return bidTypes, nil
 }
+
+func GetMediaTypeForImp(reqImps map[string]openrtb2.Imp, bidImpID string) (openrtb_ext.BidType, error) {
+	mediaType := openrtb_ext.BidTypeBanner
+
+	if reqImp, ok := reqImps[bidImpID]; ok {
+		if reqImp.Banner == nil && reqImp.Video != nil {
+			mediaType = openrtb_ext.BidTypeVideo
+		}
+		return mediaType, nil
+	}
+	return "", fmt.Errorf("unknown media type for bid imp ID %s", bidImpID)
+}
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
index 8d4e0adb1d0..f526cc86290 100644
--- a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
@@ -1,22 +1,20 @@
 {
   "mockBidRequest": {
     "id": "12345",
-    "imp": [
-      {
-        "id": "001",
-        "banner": {
-          "w": 300,
-          "h": 250
-        },
-        "ext": {
-          "bidder": {
-            "placement_id": "test"
-          }
+    "imp": [{
+      "id": "001",
+      "banner": {
+        "h": 300,
+        "w": 250
+      },
+      "ext": {
+        "bidder": {
+          "placement_id": "placement-id-1"
         }
       }
-    ],
+    }],
     "site": {
-      "domain": "test.com",
+      "domain": "https://test.com",
       "page": "https://test.com/2016/06/12"
     },
     "cur": [
@@ -29,69 +27,47 @@
     },
     "tmax": 500
   },
-  "httpCalls": [
-    {
-      "expectedRequest": {
-        "method": "POST",
-        "body": {
-          "id": "12345",
-          "imp": [
-            {
-              "id": "001",
-              "banner": {
-                "w": 300,
-                "h": 250
-              },
-              "ext": {
-                "bidder": {
-                  "placement_id": "test"
-                }
-              }
-            }
-          ],
-          "site": {
-            "domain": "test.com",
-            "page": "https://test.com/2016/06/12"
-          },
-          "cur": [
-            "USD"
-          ],
-          "device": {
-            "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
-            "ip": "127.0.0.1",
-            "language": "EN"
+  "httpCalls": [{
+    "expectedRequest": {
+      "method": "POST",
+      "body": {
+        "imps": [{
+          "bid_id": "12345",
+          "ext": {
+            "gpid": ""
           },
-          "tmax": 500
-        },
-        "impIDs": [
-          "001"
-        ]
-      },
-      "mockResponse": {
-        "status": 200,
-        "body": {
-          "bids": [
-            {
-              "bid_id": "01",
-              "imp_id": "001",
-              "cpm": 1.00,
-              "cid": "1002088",
-              "crid": "1000763-1002088",
-              "adid": "1002088",
-              "w": "300",
-              "h": "250",
-              "seat": "resetdigital",
-              "html": "<script></script>"
+          "force_bid": false,
+          "imp_id": "001",
+          "media_types": {
+            "banner": {
+              "sizes": [
+                [
+                  300,
+                  250
+                ]
+              ]
+            },
+            "video": {
+              "sizes": null
             }
-          ]
+          },
+          "zone_id": {
+            "placementId": "placement-id-1"
+          }
+        }],
+        "site": {
+          "domain": "https://test.com",
+          "referrer": "https://test.com/2016/06/12"
         }
-      }
-    }
-  ],
-  "expectedBidResponses": [
-    {
-      "bids": [
-        {
+      },
+      "impIDs": [
+        "001"
+      ]
+    },
+    "mockResponse": {
+      "status": 200,
+      "body": {
+        "bids": [{
           "bid_id": "01",
           "imp_id": "001",
           "cpm": 1.00,
@@ -101,9 +77,27 @@
           "w": "300",
           "h": "250",
           "seat": "resetdigital",
-          "html": "<script></script>"
-        }
-      ]
+          "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
+        }]
+      }
     }
-  ]
-}
\ No newline at end of file
+  }],
+
+  "expectedBidResponses": [{
+    "currency": "USD",
+    "bids": [{
+      "bid": {
+        "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
+        "cid": "1002088",
+        "crid": "1000763-1002088",
+        "id": "01",
+        "impid": "001",
+        "price": 1.00,
+        "w": 300,
+        "h": 250
+      },
+      "type": "banner",
+      "seat": "resetdigital"
+    }]
+  }]
+}
diff --git a/openrtb_ext/imp_resetdigital.go b/openrtb_ext/imp_resetdigital.go
index b9e2ac8297b..6e3f800ab98 100644
--- a/openrtb_ext/imp_resetdigital.go
+++ b/openrtb_ext/imp_resetdigital.go
@@ -1,6 +1,5 @@
 package openrtb_ext
 
-type ExtResetDigital struct {
-	BidID string `json:"bid_id"`
-	ImpID string `json:"imp_id"`
+type ImpExtResetDigital struct {
+	PlacementID string `json:"placement_id"`
 }

From baa553c3646faf043d7db5e693b59fafc427b150 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Thu, 29 Aug 2024 16:09:40 +0100
Subject: [PATCH 21/75] Simplify Tests

---
 adapters/resetdigital/resetdigital_test.go | 86 ----------------------
 1 file changed, 86 deletions(-)

diff --git a/adapters/resetdigital/resetdigital_test.go b/adapters/resetdigital/resetdigital_test.go
index 12f2dc09e17..d160e9a23fe 100644
--- a/adapters/resetdigital/resetdigital_test.go
+++ b/adapters/resetdigital/resetdigital_test.go
@@ -1,16 +1,11 @@
 package resetdigital
 
 import (
-	"encoding/json"
-	"net/http"
 	"testing"
 
-	"github.com/prebid/openrtb/v20/openrtb2"
-	"github.com/prebid/prebid-server/v2/adapters"
 	"github.com/prebid/prebid-server/v2/adapters/adapterstest"
 	"github.com/prebid/prebid-server/v2/config"
 	"github.com/prebid/prebid-server/v2/openrtb_ext"
-	"github.com/stretchr/testify/assert"
 )
 
 func TestJsonSamples(t *testing.T) {
@@ -24,84 +19,3 @@ func TestJsonSamples(t *testing.T) {
 
 	adapterstest.RunJSONBidderTest(t, "resetdigitaltest", bidder)
 }
-
-func TestMakeRequests(t *testing.T) {
-	bidder := new(adapter)
-
-	request := &openrtb2.BidRequest{
-		ID: "12345",
-
-		Imp: []openrtb2.Imp{{
-			ID: "001",
-			Banner: &openrtb2.Banner{
-				Format: []openrtb2.Format{
-					{W: 300, H: 250},
-				},
-			},
-
-			Ext: json.RawMessage(`{"bidder": {"placement_id": "test"}}`), //Placement_id test is used to get the force bid true
-		}},
-		Site: &openrtb2.Site{
-			Domain: "https://test.com",
-			Page:   "https://test.com/2016/06/12",
-		},
-		Cur: []string{"USD"},
-		Device: &openrtb2.Device{
-			UA:       "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
-			IP:       "127.0.0.1",
-			Language: "EN",
-		},
-	}
-
-	reqs, errs := bidder.MakeRequests(request, &adapters.ExtraRequestInfo{})
-
-	assert.Empty(t, errs, "Got unexpected errors while building HTTP requests: %v", errs)
-	assert.Equal(t, 1, len(reqs), "Unexpected number of HTTP requests. Got %d. Expected %d", len(reqs), 1)
-}
-
-func TestMakeBids(t *testing.T) {
-	request := &openrtb2.BidRequest{
-		ID: "12345",
-
-		Imp: []openrtb2.Imp{{
-			ID: "001",
-			Banner: &openrtb2.Banner{
-				Format: []openrtb2.Format{
-					{W: 300, H: 250},
-				},
-			},
-
-			Ext: json.RawMessage(`{"bidder": {"placement_id": "test"}}`), //Placement_id test is used to get the force bid true
-		}},
-		Site: &openrtb2.Site{
-			Domain: "https://test.com",
-			Page:   "https://test.com/2016/06/12",
-		},
-		Cur: []string{"USD"},
-		Device: &openrtb2.Device{
-			UA:       "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
-			IP:       "127.0.0.1",
-			Language: "EN",
-		},
-	}
-
-	requestJson, _ := json.Marshal(request)
-	reqData := &adapters.RequestData{
-		Method: "POST",
-		Uri:    "test-uri",
-		Body:   requestJson,
-	}
-
-	httpResp := &adapters.ResponseData{
-		StatusCode: http.StatusOK,
-		Body:       []byte(`{"bids":[{"bid_id":"01","imp_id":"001","cpm":10.00,"cid":"1002088","crid":"1000763-1002088","adid":"1002088","w":"300","h":"250","seat":"resetdigital","html":"<scriptsrc=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-15&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\"type=\"text/javascript\"></script><imagesrc='https://adsreq.resetdigital.co?brid=0000000000000001'/><imagesrc='https://sync2.resetdigital.co/hbsync?ck=0000000000000001'/>"}]}`),
-	}
-
-	bidder := new(adapter)
-	bidResponse, errs := bidder.MakeBids(request, reqData, httpResp)
-
-	assert.Empty(t, errs, "Expected 0 errors. Got %d", len(errs))
-
-	assert.Equal(t, float64(10), bidResponse.Bids[0].Bid.Price,
-		"Expected Price 10. Got: %s", bidResponse.Bids[0].Bid.Price)
-}

From ecc90bb8773699cc10e71495d3c527b80bd3af6d Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Tue, 10 Sep 2024 11:18:03 +0100
Subject: [PATCH 22/75] PR of functioning version

---
 adapters/resetdigital/resetdigital.go         | 72 +++++++++----------
 .../exemplary/simple-banner.json              |  5 +-
 static/bidder-info/resetdigital.yaml          | 35 +++++----
 static/bidder-params/resetdigital.json        | 12 +++-
 4 files changed, 60 insertions(+), 64 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index bca84364e8c..70b73c5ac6d 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -13,9 +13,6 @@ import (
 	"github.com/prebid/prebid-server/v2/openrtb_ext"
 )
 
-// MaximumBids is the maximum number of bids that can be returned by this adapter.
-const maxBids = 1
-
 type adapter struct {
 	endpoint    *template.Template
 	endpointUri string
@@ -30,7 +27,6 @@ type resetDigitalSite struct {
 	Referrer string `json:"referrer"`
 }
 type resetDigitalImp struct {
-	ForceBid   bool                   `json:"force_bid"`
 	ZoneID     resetDigitalImpZone    `json:"zone_id"`
 	BidID      string                 `json:"bid_id"`
 	ImpID      string                 `json:"imp_id"`
@@ -81,7 +77,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co
 func getHeaders(request *openrtb2.BidRequest) http.Header {
 	headers := http.Header{}
 
-	if request != nil && request.Device != nil && request.Site != nil {
+	if request != nil && request.Device != nil && request.Site != nil { // what about request.App? Do we need to do something different with Referrer in the app case assuming we care about app?
 		addNonEmptyHeaders(&headers, map[string]string{
 			"Referer":         request.Site.Page,
 			"Accept-Language": request.Device.Language,
@@ -154,24 +150,32 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 	})
 
 	if bidType == openrtb_ext.BidTypeBanner && imp.Banner != nil {
-		tempH := *imp.Banner.H
-		tempW := *imp.Banner.W
-
+		var tempH, tempW int64
+		if imp.Banner.H != nil {
+			tempH = *imp.Banner.H
+		}
+		if imp.Banner.W != nil {
+			tempW = *imp.Banner.W
+		}
 		if tempH > 0 && tempW > 0 {
 			reqData.Imps[0].MediaTypes.Banner.Sizes = append(
 				reqData.Imps[0].MediaTypes.Banner.Sizes,
-				[]int64{tempH, tempW},
+				[]int64{tempW, tempH},
 			)
 		}
 	}
 	if bidType == openrtb_ext.BidTypeVideo && imp.Video != nil {
-		tempH := *imp.Video.H
-		tempW := *imp.Video.W
-
+		var tempH, tempW int64
+		if imp.Video.H != nil {
+			tempH = *imp.Video.H
+		}
+		if imp.Video.W != nil {
+			tempW = *imp.Video.W
+		}
 		if tempH > 0 && tempW > 0 {
 			reqData.Imps[0].MediaTypes.Video.Sizes = append(
 				reqData.Imps[0].MediaTypes.Video.Sizes,
-				[]int64{tempH, tempW},
+				[]int64{tempW, tempH},
 			)
 		}
 	}
@@ -206,6 +210,7 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R
 
 	bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp))
 
+	var errs []error
 	requestImps := make(map[string]openrtb2.Imp)
 	for _, imp := range request.Imp {
 		requestImps[imp.ID] = imp
@@ -214,8 +219,10 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R
 	for i := range response.Bids {
 		resetDigitalBid := &response.Bids[i]
 
-		bid := getBidFromResponse(resetDigitalBid)
+		bid, err := getBidFromResponse(resetDigitalBid)
+		// handle the error
 		if bid == nil {
+			// it would be better to return an error here
 			continue
 		}
 
@@ -236,12 +243,13 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R
 		bidResponse.Currency = "USD"
 	}
 
-	return bidResponse, nil
+	return bidResponse, errs
 }
 
-func getBidFromResponse(bidResponse *resetDigitalBid) *openrtb2.Bid {
+func getBidFromResponse(bidResponse *resetDigitalBid) (*openrtb2.Bid, error) {
 	if bidResponse.CPM == 0 {
-		return nil
+		// brian to check how to report this
+		return nil, nil
 	}
 
 	bid := &openrtb2.Bid{
@@ -255,12 +263,17 @@ func getBidFromResponse(bidResponse *resetDigitalBid) *openrtb2.Bid {
 
 	if i, err := strconv.ParseInt(bidResponse.W, 10, 64); err == nil && i > 0 {
 		bid.W = i
-	}
+	} else if err != nil {
+		return nil, err
+	} // the error should be returned here if ParseInt fails
+
 	if i, err := strconv.ParseInt(bidResponse.H, 10, 64); err == nil && i > 0 {
 		bid.H = i
-	}
+	} else if err != nil {
+		return nil, err
+	} // the error should be returned here if ParseInt fails
 
-	return bid
+	return bid, nil
 }
 
 func getBidType(imp openrtb2.Imp) (openrtb_ext.BidType, error) {
@@ -275,25 +288,6 @@ func getBidType(imp openrtb2.Imp) (openrtb_ext.BidType, error) {
 	return "", fmt.Errorf("failed to find matching imp for bid %s", imp.ID)
 }
 
-func getBidTypes(imp openrtb2.Imp) ([]openrtb_ext.BidType, error) {
-	var bidTypes []openrtb_ext.BidType
-
-	if imp.Banner != nil {
-		bidTypes = append(bidTypes, openrtb_ext.BidTypeBanner)
-	}
-	if imp.Video != nil {
-		bidTypes = append(bidTypes, openrtb_ext.BidTypeVideo)
-	}
-	if imp.Audio != nil {
-		bidTypes = append(bidTypes, openrtb_ext.BidTypeAudio)
-	}
-	if len(bidTypes) == 0 {
-		return nil, fmt.Errorf("failed to find matching imp for bid %s", imp.ID)
-	}
-
-	return bidTypes, nil
-}
-
 func GetMediaTypeForImp(reqImps map[string]openrtb2.Imp, bidImpID string) (openrtb_ext.BidType, error) {
 	mediaType := openrtb_ext.BidTypeBanner
 
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
index f526cc86290..bf22010c6fd 100644
--- a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
@@ -36,14 +36,13 @@
           "ext": {
             "gpid": ""
           },
-          "force_bid": false,
           "imp_id": "001",
           "media_types": {
             "banner": {
               "sizes": [
                 [
-                  300,
-                  250
+                  250,
+                  300
                 ]
               ]
             },
diff --git a/static/bidder-info/resetdigital.yaml b/static/bidder-info/resetdigital.yaml
index 99c22378318..3c4a206389a 100644
--- a/static/bidder-info/resetdigital.yaml
+++ b/static/bidder-info/resetdigital.yaml
@@ -1,19 +1,16 @@
-    endpoint: http://b-us-east14.resetdigital.co:9001
-    meta-info:
-      maintainer-email: biddersupport@resetdigital.co
-      app-media-types:
-        - banner
-        - video
-        - audio
-      site-media-types:
-        - banner
-        - video
-        - audio
-      supported-vendors:
-      vendor-id: 1162
-    usersync:
-      cookie-family-name: resetdigital
-      redirect:
-        url: https://sync.resetdigital.co/csync?pid=rubicon&redir={{redirect_url}}
-        support-cors: false
-        uid-macro: '$USER_ID'
+endpoint: http://b-us-east14.resetdigital.co:9001
+maintainer:
+  email: biddersupport@resetdigital.co
+capabilities:
+  site:
+    mediaTypes:
+    - banner
+    - video
+    - audio
+gvlVendorID: 1162
+userSync:
+  key: resetdigital
+  supportCors: false
+  redirect:
+    url: https://sync.resetdigital.co/csync?pid=rubicon&redir={{redirect_url}}
+    userMacro: '$USER_ID'
diff --git a/static/bidder-params/resetdigital.json b/static/bidder-params/resetdigital.json
index d2bcfb6bb5f..4d0538893f7 100644
--- a/static/bidder-params/resetdigital.json
+++ b/static/bidder-params/resetdigital.json
@@ -1,7 +1,13 @@
 {
     "$schema": "http://json-schema.org/draft-04/schema#",
-    "title": "Relevant Digital Adapter Params",
-    "description": "A schema which validates params accepted by the Relevant Digital adapter",
+    "title": "Reset Digital Adapter Params",
+    "description": "A schema which validates params accepted by the Reset Digital adapter",
     "type": "object",
-    "properties": {}
+    "properties": {
+        "placement_id": {
+            "type": "string",
+            "minLength": 1,
+            "description": "Placement ID for the Reset Digital ad unit. This is the identifier for the ad unit on the Reset Digital platform, and its optional"
+        }
+    }
 }

From 0d54a8d13f7a652fc10815bd7efcc8bfa3ce36d2 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Sun, 29 Sep 2024 20:07:47 +0100
Subject: [PATCH 23/75] Added Video and removed unwanted data

---
 .../examplary/test-missing-cur.json           |  86 -------------
 .../examplary/test-missing-site.json          |  64 ----------
 .../examplary/test-multi-format.json          | 119 ------------------
 .../examplary/test-request-error.json         |  74 -----------
 .../exemplary/simple-video.json               | 106 ++++++++++++++++
 5 files changed, 106 insertions(+), 343 deletions(-)
 delete mode 100644 adapters/resetdigital/resetdigitaltest/examplary/test-missing-cur.json
 delete mode 100644 adapters/resetdigital/resetdigitaltest/examplary/test-missing-site.json
 delete mode 100644 adapters/resetdigital/resetdigitaltest/examplary/test-multi-format.json
 delete mode 100644 adapters/resetdigital/resetdigitaltest/examplary/test-request-error.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json

diff --git a/adapters/resetdigital/resetdigitaltest/examplary/test-missing-cur.json b/adapters/resetdigital/resetdigitaltest/examplary/test-missing-cur.json
deleted file mode 100644
index 5b997219cc6..00000000000
--- a/adapters/resetdigital/resetdigitaltest/examplary/test-missing-cur.json
+++ /dev/null
@@ -1,86 +0,0 @@
-{
-  "mockBidRequest": {
-    "id": "12345",
-    "imp": [
-      {
-        "id": "001",
-        "banner": {
-          "w": 300,
-          "h": 250
-        },
-        "ext": {
-          "bidder": {
-            "placement_id": "test"
-          }
-        }
-      }
-    ],
-    "site": {
-      "domain": "https://test.com",
-      "page": "https://test.com/2016/06/12"
-    },
-    "cur": [],
-    "device": {
-      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
-      "ip": "127.0.0.1",
-      "language": "EN"
-    },
-    "tmax": 500
-  },
-  "httpCalls": [
-    {
-      "language": "en-US",
-      "site": {
-        "domain": "https://test.com",
-        "referrer": "https://test.com/2016/06/12"
-      },
-      "imps": [
-        {
-          "force_bid": 1,
-          "zone_id": {
-            "placementId": "test"
-          },
-          "bid_id": "01",
-          "imp_id": "001",
-          "ext": {
-            "gpid": "test"
-          },
-          "sizes": [
-            [
-              300,
-              250
-            ]
-          ],
-          "media_types": {
-            "banner": {
-              "sizes": [
-                [
-                  300,
-                  250
-                ]
-              ]
-            }
-          }
-        }
-      ]
-    }
-  ],
-  "expectedBidResponses": [
-    {
-      "bids": [
-        {
-          "bid_id": "01",
-          "imp_id": "001",
-          "cpm": 1.0,
-          "cid": "1002088",
-          "crid": "1000763-1002088",
-          "adid": "1002088",
-          "w": "300",
-          "h": "250",
-          "seat": "resetdigital",
-          "html": "<script  />"
-        }
-      ]
-    }
-  ]
-}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/test-missing-site.json b/adapters/resetdigital/resetdigitaltest/examplary/test-missing-site.json
deleted file mode 100644
index 84660ad96b8..00000000000
--- a/adapters/resetdigital/resetdigitaltest/examplary/test-missing-site.json
+++ /dev/null
@@ -1,64 +0,0 @@
-{
-  "mockBidRequest": {
-    "id": "12345",
-    "imp": [
-      {
-        "id": "001",
-        "banner": {
-          "w": 300,
-          "h": 250
-        },
-        "ext": {
-          "bidder": {
-            "placement_id": "test"
-          }
-        }
-      }
-    ],
-    "cur": [
-      "USD"
-    ],
-    "device": {
-      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
-      "ip": "127.0.0.1",
-      "language": "EN"
-    },
-    "tmax": 500
-  },
-  "httpCalls": [
-    {
-      "language": "en-US",
-      "site": {},
-      "imps": [
-        {
-          "force_bid": 1,
-          "zone_id": {
-            "placementId": "test"
-          },
-          "bid_id": "01",
-          "imp_id": "001",
-          "ext": {
-            "gpid": "test"
-          },
-          "sizes": [
-            [
-              300,
-              250
-            ]
-          ],
-          "media_types": {
-            "banner": {
-              "sizes": [
-                [
-                  300,
-                  250
-                ]
-              ]
-            }
-          }
-        }
-      ]
-    }
-  ],
-  "expectedBidResponses": []
-}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/test-multi-format.json b/adapters/resetdigital/resetdigitaltest/examplary/test-multi-format.json
deleted file mode 100644
index c0278301bc0..00000000000
--- a/adapters/resetdigital/resetdigitaltest/examplary/test-multi-format.json
+++ /dev/null
@@ -1,119 +0,0 @@
-{
-  "mockBidRequest": {
-    "id": "12345",
-    "imp": [
-      {
-        "id": "001",
-        "banner": {
-          "w": 300,
-          "h": 250
-        },
-        "video": {
-          "mimes": [
-            "video/mp4"
-          ],
-          "minduration": 5,
-          "maxduration": 60,
-          "protocols": [
-            2,
-            3
-          ],
-          "w": 640,
-          "h": 480
-        },
-        "audio": {
-          "mimes": [
-            "audio/mp3"
-          ],
-          "minduration": 5,
-          "maxduration": 60
-        },
-        "ext": {
-          "bidder": {
-            "placement_id": "test"
-          }
-        }
-      }
-    ],
-    "site": {
-      "domain": "https://test.com",
-      "page": "https://test.com/2016/06/12"
-    },
-    "cur": [
-      "USD"
-    ],
-    "device": {
-      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
-      "ip": "127.0.0.1",
-      "language": "EN"
-    },
-    "tmax": 500
-  },
-  "httpCalls": [
-    {
-      "language": "en-US",
-      "site": {
-        "domain": "https://test.com",
-        "referrer": "https://test.com/2016/06/12"
-      },
-      "imps": [
-        {
-          "force_bid": 1,
-          "zone_id": {
-            "placementId": "test"
-          },
-          "bid_id": "01",
-          "imp_id": "001",
-          "ext": {
-            "gpid": "test"
-          },
-          "sizes": [
-            [
-              300,
-              250
-            ]
-          ],
-          "media_types": {
-            "banner": {
-              "sizes": [
-                [
-                  300,
-                  250
-                ]
-              ]
-            },
-            "video": {
-              "sizes": [
-                [
-                  640,
-                  480
-                ]
-              ]
-            },
-            "audio": {
-              "sizes": []
-            }
-          }
-        }
-      ]
-    }
-  ],
-  "expectedBidResponses": [
-    {
-      "bids": [
-        {
-          "bid_id": "01",
-          "imp_id": "001",
-          "cpm": 1.0,
-          "cid": "1002088",
-          "crid": "1000763-1002088",
-          "adid": "1002088",
-          "w": "300",
-          "h": "250",
-          "seat": "resetdigital",
-          "html": "<script  />"
-        }
-      ]
-    }
-  ]
-}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/test-request-error.json b/adapters/resetdigital/resetdigitaltest/examplary/test-request-error.json
deleted file mode 100644
index 11c17e8e36d..00000000000
--- a/adapters/resetdigital/resetdigitaltest/examplary/test-request-error.json
+++ /dev/null
@@ -1,74 +0,0 @@
-{
-  "mockBidRequest": {
-    "id": "12345",
-    "imp": [
-      {
-        "id": "001",
-        "banner": {
-          "w": 300,
-          "h": 250
-        },
-        "ext": {
-          "bidder": {
-            "placement_id": "test"
-          }
-        }
-      }
-    ],
-    "site": {
-      "domain": "https://test.com",
-      "page": "https://test.com/2016/06/12"
-    },
-    "cur": [
-      "USD"
-    ],
-    "device": {
-      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
-      "ip": "127.0.0.1",
-      "language": "EN"
-    },
-    "tmax": 500
-  },
-  "httpCalls": [
-    {
-      "language": "en-US",
-      "site": {
-        "domain": "https://test.com",
-        "referrer": "https://test.com/2016/06/12"
-      },
-      "imps": [
-        {
-          "force_bid": 1,
-          "zone_id": {
-            "placementId": "test"
-          },
-          "bid_id": "01",
-          "imp_id": "001",
-          "ext": {
-            "gpid": "test"
-          },
-          "sizes": [
-            [
-              300,
-              250
-            ]
-          ],
-          "media_types": {
-            "banner": {
-              "sizes": [
-                [
-                  300,
-                  250
-                ]
-              ]
-            }
-          }
-        }
-      ]
-    }
-  ],
-  "expectedBidResponses": [],
-  "errors": [
-    "Error in request processing"
-  ]
-}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json
new file mode 100644
index 00000000000..260217be957
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json
@@ -0,0 +1,106 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [{
+      "id": "001",
+      "video": {
+          "w": 900,
+          "h": 250,
+          "mimes": [
+            "video/x-flv",
+            "video/mp4"
+          ]
+        },
+      "ext": {
+        "bidder": {
+          "placement_id": "placement-id-1"
+        }
+      }
+    }],
+    "site": {
+      "domain": "https://test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "cur": [
+      "USD"
+    ],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [{
+    "expectedRequest": {
+      "method": "POST",
+      "body": {
+        "imps": [{
+          "bid_id": "12345",
+          "ext": {
+            "gpid": ""
+          },
+          "imp_id": "001",
+          "media_types": {
+            "banner": {
+             "sizes": null
+            },
+            "video": {
+              "sizes": [
+                [
+                  900,
+                  250
+                ]
+              ]
+            }
+          },
+          "zone_id": {
+            "placementId": "placement-id-1"
+          }
+        }],
+        "site": {
+          "domain": "https://test.com",
+          "referrer": "https://test.com/2016/06/12"
+        }
+      },
+      "impIDs": [
+        "001"
+      ]
+    },
+    "mockResponse": {
+      "status": 200,
+      "body": {
+        "bids": [{
+          "bid_id": "01",
+          "imp_id": "001",
+          "cpm": 1.00,
+          "cid": "1002088",
+          "crid": "1000763-1002088",
+          "adid": "1002088",
+          "w": "900",
+          "h": "250",
+          "seat": "resetdigital",
+          "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
+        }]
+      }
+    }
+  }],
+
+  "expectedBidResponses": [{
+    "currency": "USD",
+    "bids": [{
+      "bid": {
+        "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
+        "cid": "1002088",
+        "crid": "1000763-1002088",
+        "id": "01",
+        "impid": "001",
+        "price": 1.00,
+        "w": 900,
+        "h": 250
+      },
+      "type": "video",
+      "seat": "resetdigital"
+    }]
+  }]
+}

From 660dba7dc71bd46177807ed4ae5e88405c480cbf Mon Sep 17 00:00:00 2001
From: Emmanuel <eogbonna097@gmail.com>
Date: Fri, 25 Oct 2024 12:12:54 +0100
Subject: [PATCH 24/75] created mock test

---
 adapters/resetdigital/resetdigital.go         |  23 ++--
 .../exemplary/invalid_video_dim.json          |  74 ++++++++++++
 .../supplemental/fake_test.json               |  69 +++++++++++
 .../supplemental/invalid-device.json          |  74 ++++++++++++
 .../supplemental/invalid_cur.json             |  76 ++++++++++++
 .../supplemental/invalid_media_def.json       |  35 ++++++
 .../supplemental/invalid_placement_id.json    |  43 +++++++
 .../supplemental/multi_format.json            | 108 ++++++++++++++++++
 .../supplemental/unknown_media.json           |  68 +++++++++++
 9 files changed, 559 insertions(+), 11 deletions(-)
 create mode 100644 adapters/resetdigital/resetdigitaltest/exemplary/invalid_video_dim.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/fake_test.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/invalid_media_def.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/invalid_placement_id.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 70b73c5ac6d..6ea7faf566f 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -223,12 +223,14 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R
 		// handle the error
 		if bid == nil {
 			// it would be better to return an error here
+			errs = append(errs, err)
 			continue
 		}
 
 		bidType, err := GetMediaTypeForImp(requestImps, bid.ImpID)
 		if err != nil {
-			return nil, []error{err}
+			errs = append(errs, err)
+			continue
 		}
 
 		b := &adapters.TypedBid{
@@ -261,18 +263,17 @@ func getBidFromResponse(bidResponse *resetDigitalBid) (*openrtb2.Bid, error) {
 		AdM:   bidResponse.HTML,
 	}
 
-	if i, err := strconv.ParseInt(bidResponse.W, 10, 64); err == nil && i > 0 {
-		bid.W = i
-	} else if err != nil {
+	w, err := strconv.ParseInt(bidResponse.W, 10, 64)
+	if err != nil {
 		return nil, err
-	} // the error should be returned here if ParseInt fails
+	}
+	bid.W = w
 
-	if i, err := strconv.ParseInt(bidResponse.H, 10, 64); err == nil && i > 0 {
-		bid.H = i
-	} else if err != nil {
+	h, err := strconv.ParseInt(bidResponse.H, 10, 64)
+	if err != nil {
 		return nil, err
-	} // the error should be returned here if ParseInt fails
-
+	}
+	bid.H = h
 	return bid, nil
 }
 
@@ -298,4 +299,4 @@ func GetMediaTypeForImp(reqImps map[string]openrtb2.Imp, bidImpID string) (openr
 		return mediaType, nil
 	}
 	return "", fmt.Errorf("unknown media type for bid imp ID %s", bidImpID)
-}
+}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/invalid_video_dim.json b/adapters/resetdigital/resetdigitaltest/exemplary/invalid_video_dim.json
new file mode 100644
index 00000000000..6cbc6cf2be8
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/invalid_video_dim.json
@@ -0,0 +1,74 @@
+{
+    "mockBidRequest": {
+      "id": "12345",
+      "imp": [{
+        "id": "001",
+        "video": {
+            "w": 0,
+            "h": 480,
+            "mimes": [
+              "video/x-flv",
+              "video/mp4"
+            ]
+          },
+          "ext": {
+            "bidder": {
+              "placement_id": "placement-id-1"
+            }
+          }
+      }],
+      "site": {
+        "domain": "https://test.com",
+        "page": "https://test.com/2016/06/12"
+      },
+      "cur": [
+        "USD"
+      ],
+      "device": {
+        "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+        "ip": "127.0.0.1",
+        "language": "EN"
+      },
+      "tmax": 500,
+      "debug": 1 
+    },
+    "httpCalls": [{
+      "expectedRequest": {
+        "method": "POST",
+        "body": {
+          "imps": [{
+            "bid_id": "12345",
+            "ext": {
+              "gpid": ""
+            },
+            "imp_id": "001",
+            "media_types": {
+              "banner": {
+               "sizes": null
+              },
+              "video": {
+                "sizes": null
+              }
+            },
+            "zone_id": {
+              "placementId": "placement-id-1"
+            }
+          }],
+          "site": {
+            "domain": "https://test.com",
+            "referrer": "https://test.com/2016/06/12"
+          }
+        },
+        "impIDs": [
+          "001"
+        ]
+      },
+      "mockResponse": {
+        "status": 204,
+        "body": {
+          "error": "Unexpected status code: 204. Run with request.debug = 1 for more info"
+        }
+      }
+    }],
+    "expectedBidResponses": []
+  }
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/fake_test.json b/adapters/resetdigital/resetdigitaltest/supplemental/fake_test.json
new file mode 100644
index 00000000000..7cb52868e6c
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/fake_test.json
@@ -0,0 +1,69 @@
+{
+    "mockBidRequest": {
+      "id": "test_nil_invalid_impid",
+      "imp": [
+        {
+          "id": null,  
+          "banner": {
+            "h": 250,
+            "w": 300
+          },
+          "ext": {
+            "bidder": {
+              "placement_id": "placement-id-7"
+            }
+          }
+        }
+      ],
+      "site": {
+        "domain": "https://example.com",
+        "page": "https://example.com/page"
+      },
+      "cur": ["USD"],
+      "device": {
+        "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
+        "ip": "192.168.0.1",
+        "language": "EN"
+      },
+      "tmax": 500
+    },
+    "httpCalls": [
+      {
+        "expectedRequest": {
+          "method": "POST",
+          "body": {
+            "imps": [
+              {
+                "bid_id": "test_nil_invalid_impid",
+                "imp_id": null, 
+                "media_types": {
+                  "banner": {
+                    "sizes": [[300, 250]]
+                  }
+                },
+                "zone_id": {
+                  "placementId": "placement-id-7"
+                }
+              }
+            ],
+            "site": {
+              "domain": "https://example.com",
+              "referrer": "https://example.com/page"
+            }
+          },
+          "impIDs": ["006", null, "unknown_imp_id"]
+        }
+      }
+    ],
+    "expectedMakeBidsErrors": [
+      {
+        "value": "bid is nil or imp ID is missing",
+        "comparison": "literal"
+      },
+      {
+        "value": "unknown media type for bid imp ID unknown_imp_id",
+        "comparison": "literal"
+      }
+    ]
+  }
+  
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json
new file mode 100644
index 00000000000..6865ffc355c
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json
@@ -0,0 +1,74 @@
+{
+    "mockBidRequest": {
+      "id": "test-invalid-device",
+      "imp": [{
+        "id": "001",
+        "banner": {
+          "h": 300,
+          "w": 250
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "placement-id-1"
+          }
+        }
+      }],
+      "site": {
+        "domain": "https://test.com",
+        "page": "https://test.com/2016/06/12"
+      },
+      "cur": [
+        "USD"
+      ]
+    },
+    "httpCalls": [{
+      "expectedRequest": {
+        "method": "POST",
+        "body": {
+          "imps": [{
+            "bid_id": "test-invalid-device",
+            "ext": {
+              "gpid": ""
+            },
+            "imp_id": "001",
+            "media_types": {
+              "banner": {
+                "sizes": [
+                  [
+                    250,
+                    300
+                  ]
+                ]
+              },
+              "video": {
+                "sizes": null
+              }
+            },
+            "zone_id": {
+              "placementId": "placement-id-1"
+            }
+          }],
+          "site": {
+            "domain": "https://test.com",
+            "referrer": "https://test.com/2016/06/12"
+          }
+        },
+        "impIDs": [
+          "001"
+        ]
+      },
+      "mockResponse": {
+        "status": 400,
+        "body": {
+          "error": "Unexpected status code: 400. Run with request.debug = 1 for more info"
+        }
+      }
+    }],
+    "expectedMakeBidsErrors": [
+        {
+          "value": "Unexpected status code: 400. Run with request.debug = 1 for more info",
+          "comparison": "literal"
+        }
+      ]
+  }
+  
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json
new file mode 100644
index 00000000000..d148516b1c2
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json
@@ -0,0 +1,76 @@
+{
+    "mockBidRequest": {
+      "id": "test-invalid-cur",
+      "imp": [{
+        "id": "001",
+        "banner": {
+          "h": 300,
+          "w": 250
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "placement-id-1"
+          }
+        }
+      }],
+      "site": {
+        "domain": "https://test.com",
+        "page": "https://test.com/2016/06/12"
+      },
+      "device": {
+        "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+        "ip": "127.0.0.1",
+        "language": "EN"
+      }
+    },
+    "httpCalls": [{
+        "expectedRequest": {
+          "method": "POST",
+          "body": {
+            "imps": [{
+              "bid_id": "test-invalid-cur",
+              "ext": {
+                "gpid": ""
+              },
+              "imp_id": "001",
+              "media_types": {
+                "banner": {
+                  "sizes": [
+                    [
+                      250,
+                      300
+                    ]
+                  ]
+                },
+                "video": {
+                  "sizes": null
+                }
+              },
+              "zone_id": {
+                "placementId": "placement-id-1"
+              }
+            }],
+            "site": {
+              "domain": "https://test.com",
+              "referrer": "https://test.com/2016/06/12"
+            }
+          },
+          "impIDs": [
+            "001"
+          ]
+        },
+        "mockResponse": {
+          "status": 400,
+          "body": {
+            "error": "Unexpected status code: 400. Run with request.debug = 1 for more info"
+          }
+        }
+      }],
+      "expectedMakeBidsErrors": [
+        {
+          "value": "Unexpected status code: 400. Run with request.debug = 1 for more info",
+          "comparison": "literal"
+        }
+      ]
+  }
+  
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid_media_def.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_media_def.json
new file mode 100644
index 00000000000..0c24e666b9f
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_media_def.json
@@ -0,0 +1,35 @@
+{
+    "mockBidRequest": {
+      "id": "12345",
+      "imp": [{
+        "id": "001",
+          "ext": {
+            "bidder": {
+              "placement_id": "placement-id-1"
+            }
+          }
+      }],
+      "site": {
+        "domain": "https://test.com",
+        "page": "https://test.com/2016/06/12"
+      },
+      "cur": [
+        "USD"
+      ],
+      "device": {
+        "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+        "ip": "127.0.0.1",
+        "language": "EN"
+      },
+      "tmax": 500,
+      "debug": 1 
+    },
+    "httpCalls": [],
+    "expectedMakeRequestsErrors": [
+      {
+        "value": "failed to find matching imp for bid 001",
+        "comparison": "literal"
+      }
+    ],
+    "expectedBidResponses": []
+  }
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid_placement_id.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_placement_id.json
new file mode 100644
index 00000000000..14959b36d14
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_placement_id.json
@@ -0,0 +1,43 @@
+{
+    "mockBidRequest": {
+      "id": "12345",
+      "imp": [{
+        "id": "001",
+        "video": {
+            "w": 900,
+            "h": 250,
+            "mimes": [
+              "video/x-flv",
+              "video/mp4"
+            ]
+          },
+        "ext": {
+          "bidder": {
+            "placement_id": 1
+          }
+        }
+      }],
+      "site": {
+        "domain": "https://test.com",
+        "page": "https://test.com/2016/06/12"
+      },
+      "cur": [
+        "USD"
+      ],
+      "device": {
+        "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+        "ip": "127.0.0.1",
+        "language": "EN"
+      },
+      "tmax": 500,
+      "debug": 1 
+    },
+    "httpCalls": [],
+    "expectedMakeRequestsErrors": [
+      {
+        "value": "json: cannot unmarshal number into Go struct field ImpExtResetDigital.placement_id of type string",
+        "comparison": "literal"
+      }
+    ],
+    "expectedBidResponses": []
+  }
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json b/adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json
new file mode 100644
index 00000000000..f17e0d149ab
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json
@@ -0,0 +1,108 @@
+{
+    "mockBidRequest": {
+      "id": "test-multi-format",
+      "imp": [{
+        "id": "001",
+        "banner": {
+          "w": 300,
+          "h": 600
+        },
+        "video": {
+          "w": 900,
+          "h": 250,
+          "mimes": ["video/mp4"]
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "placement-id-1"
+          }
+        }
+      }],
+      "site": {
+        "domain": "https://test.com",
+        "page": "https://test.com/2016/06/12"
+      },
+      "cur": [
+        "USD"
+      ],
+      "device": {
+        "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+        "ip": "127.0.0.1",
+        "language": "EN"
+      },
+      "tmax": 500
+    },
+    "httpCalls": [{
+      "expectedRequest": {
+        "method": "POST",
+        "body": {
+            "imps": [{
+              "bid_id": "test-multi-format",
+              "ext": {
+                "gpid": ""
+              },
+              "imp_id": "001",
+              "media_types": {
+                "banner": {
+                  "sizes": [
+                    [
+                      300,
+                      600
+                    ]
+                  ]
+                },
+                "video": {
+                  "sizes": null
+                }
+              },
+              "zone_id": {
+                "placementId": "placement-id-1"
+              }
+            }],
+            "site": {
+              "domain": "https://test.com",
+              "referrer": "https://test.com/2016/06/12"
+            }
+          },
+        "impIDs": [
+            "001"
+          ]
+      },
+      "mockResponse": {
+        "status": 200,
+        "body": {
+          "bids": [{
+            "bid_id": "01",
+            "imp_id": "001",
+            "cpm": 1.00,
+            "cid": "1002088",
+            "crid": "1000763-1002088",
+            "adid": "1002088",
+            "w": "300",
+            "h": "250",
+            "seat": "resetdigital",
+            "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
+          }]
+        }
+      }
+    }],
+  
+    "expectedBidResponses": [{
+      "currency": "USD",
+      "bids": [{
+        "bid": {
+          "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
+          "cid": "1002088",
+          "crid": "1000763-1002088",
+          "id": "01",
+          "impid": "001",
+          "price": 1.00,
+          "w": 300,
+          "h": 250
+        },
+        "type": "banner",
+        "seat": "resetdigital"
+      }]
+    }]
+  }
+  
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json b/adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json
new file mode 100644
index 00000000000..08cd3f22944
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json
@@ -0,0 +1,68 @@
+{
+    "mockBidRequest": {
+      "id": "test-unknown-media-type",
+      "imp": [{
+        "id": "001",
+        "audio": { 
+          "mimes": ["audio/mpeg"]
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "placement-id-1"
+          }
+        }
+      }],
+     "site": {
+        "domain": "https://test.com",
+        "page": "https://test.com/2016/06/12"
+      },
+      "cur": [
+        "USD"
+      ]
+    },
+    "httpCalls": [{
+      "expectedRequest": {
+        "method": "POST",
+        "body": {
+          "imps": [{
+            "bid_id": "test-unknown-media-type",
+            "ext": {
+              "gpid": ""
+            },
+            "imp_id": "001",
+            "media_types": {
+              "banner": {
+                "sizes": null
+              },
+              "video": {
+                  "sizes": null
+              }
+            },
+            "zone_id": {
+              "placementId": "placement-id-1"
+            }
+          }],
+          "site": {
+            "domain": "https://test.com",
+            "referrer": "https://test.com/2016/06/12"
+          }
+        },
+        "impIDs": [
+          "001"
+        ]
+      },
+      "mockResponse": {
+        "status": 400,
+        "body": {
+          "error": "unknown media type for bid imp ID 003"
+        }
+      }
+    }],
+    "expectedMakeBidsErrors": [
+      {
+        "value": "Unexpected status code: 400. Run with request.debug = 1 for more info",
+        "comparison": "literal"
+      }
+    ]
+  }
+  
\ No newline at end of file

From 5f70f11ed1138b1a2e658b0b7e3ce8f2a2f26787 Mon Sep 17 00:00:00 2001
From: Emmanuel <eogbonna097@gmail.com>
Date: Thu, 31 Oct 2024 15:35:08 +0100
Subject: [PATCH 25/75] delete fake_test.json

---
 .../supplemental/fake_test.json               | 69 -------------------
 1 file changed, 69 deletions(-)
 delete mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/fake_test.json

diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/fake_test.json b/adapters/resetdigital/resetdigitaltest/supplemental/fake_test.json
deleted file mode 100644
index 7cb52868e6c..00000000000
--- a/adapters/resetdigital/resetdigitaltest/supplemental/fake_test.json
+++ /dev/null
@@ -1,69 +0,0 @@
-{
-    "mockBidRequest": {
-      "id": "test_nil_invalid_impid",
-      "imp": [
-        {
-          "id": null,  
-          "banner": {
-            "h": 250,
-            "w": 300
-          },
-          "ext": {
-            "bidder": {
-              "placement_id": "placement-id-7"
-            }
-          }
-        }
-      ],
-      "site": {
-        "domain": "https://example.com",
-        "page": "https://example.com/page"
-      },
-      "cur": ["USD"],
-      "device": {
-        "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
-        "ip": "192.168.0.1",
-        "language": "EN"
-      },
-      "tmax": 500
-    },
-    "httpCalls": [
-      {
-        "expectedRequest": {
-          "method": "POST",
-          "body": {
-            "imps": [
-              {
-                "bid_id": "test_nil_invalid_impid",
-                "imp_id": null, 
-                "media_types": {
-                  "banner": {
-                    "sizes": [[300, 250]]
-                  }
-                },
-                "zone_id": {
-                  "placementId": "placement-id-7"
-                }
-              }
-            ],
-            "site": {
-              "domain": "https://example.com",
-              "referrer": "https://example.com/page"
-            }
-          },
-          "impIDs": ["006", null, "unknown_imp_id"]
-        }
-      }
-    ],
-    "expectedMakeBidsErrors": [
-      {
-        "value": "bid is nil or imp ID is missing",
-        "comparison": "literal"
-      },
-      {
-        "value": "unknown media type for bid imp ID unknown_imp_id",
-        "comparison": "literal"
-      }
-    ]
-  }
-  
\ No newline at end of file

From a083c0326961917b7c52a9e0fdc4a0f7b9d6e0a5 Mon Sep 17 00:00:00 2001
From: Dirk Merkel <dirk@resetdigital.co>
Date: Sun, 3 Nov 2024 15:26:36 -0800
Subject: [PATCH 26/75] Adding support for audio media type and a corresponding
 simple-audio.json test case.

---
 -vv                                           |  78 ++++++++
 adapters/resetdigital/resetdigital.go         |  17 +-
 .../exemplary/simple-audio.json               | 183 ++++++++++++++++++
 .../exemplary/simple-banner.json              |   6 +
 .../exemplary/simple-video.json               | 170 +++++++++-------
 .../supplemental/invalid-device.json          |   6 +
 .../supplemental/invalid_cur.json             |   6 +
 .../invalid_video_dim.json                    |  11 +-
 .../supplemental/multi_format.json            |   6 +
 .../supplemental/unknown_media.json           |   8 +-
 10 files changed, 412 insertions(+), 79 deletions(-)
 create mode 100644 -vv
 create mode 100644 adapters/resetdigital/resetdigitaltest/exemplary/simple-audio.json
 rename adapters/resetdigital/resetdigitaltest/{exemplary => supplemental}/invalid_video_dim.json (86%)

diff --git a/-vv b/-vv
new file mode 100644
index 00000000000..28f4857db7b
--- /dev/null
+++ b/-vv
@@ -0,0 +1,78 @@
+mode: set
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:67.119,69.16 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:69.16,71.3 1 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:72.2,75.20 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:78.59,81.68 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:81.68,91.3 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:92.2,92.16 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:95.79,96.39 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:96.39,97.21 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:97.21,99.4 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:103.141,109.38 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:109.38,111.17 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:111.17,113.12 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:116.3,117.17 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:117.17,119.12 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:122.3,123.17 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:123.17,125.12 2 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:128.3,134.5 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:137.2,137.25 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:140.139,143.29 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:143.29,146.3 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:148.2,153.63 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:153.63,155.26 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:155.26,157.4 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:158.3,158.26 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:158.26,160.4 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:161.3,161.29 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:161.29,166.4 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:168.2,168.61 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:168.61,170.25 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:170.25,172.4 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:173.3,173.25 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:173.25,175.4 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:176.3,176.29 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:176.29,181.4 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:183.2,183.61 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:183.62,197.3 0 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:199.2,202.60 3 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:202.60,204.3 1 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:205.2,205.75 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:205.75,207.3 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:208.2,210.21 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:213.166,214.58 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:214.58,216.3 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:218.2,218.80 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:218.80,220.3 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:222.2,223.69 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:223.69,225.3 1 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:227.2,231.34 4 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:231.34,233.3 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:235.2,235.31 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:235.31,240.17 3 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:240.17,243.12 2 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:246.3,247.17 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:247.17,249.12 2 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:252.3,257.49 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:260.2,260.27 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:260.27,262.3 1 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:264.2,264.26 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:267.78,268.26 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:268.26,271.3 1 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:273.2,283.16 3 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:283.16,285.3 1 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:286.2,289.16 3 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:289.16,291.3 1 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:292.2,293.17 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:296.64,297.23 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:297.23,299.3 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:299.8,299.29 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:299.29,301.3 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:301.8,301.29 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:301.29,303.3 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:305.2,305.73 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:308.104,311.41 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:311.41,312.50 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:312.50,316.4 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:317.3,317.24 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:319.2,319.73 1 0
diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 6ea7faf566f..5f3f4b1b333 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -42,11 +42,12 @@ type resetDigitalImpExt struct {
 type resetDigitalMediaTypes struct {
 	Banner resetDigitalMediaType `json:"banner"`
 	Video  resetDigitalMediaType `json:"video"`
+	Audio  resetDigitalMediaType `json:"audio"`
 }
 type resetDigitalMediaType struct {
 	Sizes [][]int64 `json:"sizes"`
+	Mimes []string `json:"mimes"`
 }
-
 type resetDigitalBidResponse struct {
 	Bids []resetDigitalBid `json:"bids"`
 }
@@ -178,6 +179,16 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 				[]int64{tempW, tempH},
 			)
 		}
+		if imp.Video.MIMEs != nil{
+			reqData.Imps[0].MediaTypes.Video.Mimes = append(
+				imp.Video.MIMEs,
+			)
+		}
+	}
+	if bidType == openrtb_ext.BidTypeAudio && imp.Audio != nil && imp.Audio.MIMEs != nil{
+		reqData.Imps[0].MediaTypes.Audio.Mimes = append(
+			imp.Audio.MIMEs,
+		)
 	}
 
 	var bidderExt adapters.ExtImpBidder
@@ -295,8 +306,10 @@ func GetMediaTypeForImp(reqImps map[string]openrtb2.Imp, bidImpID string) (openr
 	if reqImp, ok := reqImps[bidImpID]; ok {
 		if reqImp.Banner == nil && reqImp.Video != nil {
 			mediaType = openrtb_ext.BidTypeVideo
+		} else if reqImp.Audio != nil {
+			mediaType = openrtb_ext.BidTypeAudio
 		}
 		return mediaType, nil
 	}
 	return "", fmt.Errorf("unknown media type for bid imp ID %s", bidImpID)
-}
\ No newline at end of file
+}
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-audio.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-audio.json
new file mode 100644
index 00000000000..80ae00517f6
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-audio.json
@@ -0,0 +1,183 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "at": 1,
+    "bcat": [
+      "IAB24",
+      "IAB25",
+      "IAB26"
+    ],
+    "cur": [
+      "USD"
+    ],
+    "source": {
+      "fd": 0,
+      "tid": "00000FBCE10DE8FA",
+      "schain": {
+        "complete": 1,
+        "ver": "1.0",
+        "nodes": [
+          {
+            "asi": "resetdigital.co",
+            "sid": "176",
+            "hp": 1
+          }
+        ]
+      }
+    },
+    "device": {
+      "ip": "35.146.176.97",
+      "js": 1,
+      "language": "en",
+      "ua": "PostmanRuntime/7.42.0"
+    },
+    "user": {
+      "id": "000011200BA1065C",
+      "buyeruid": "000011200BA1065C"
+    },
+    "app": {
+      "id": "test.com",
+      "bundle": "test.com",
+      "name": "test.com",
+      "content": {
+        "livestream": 1,
+        "genre": "F%C3%BAtbol",
+        "cat": [
+          ""
+        ],
+        "language": "es"
+      },
+      "publisher": {
+        "id": "176"
+      },
+      "keywords": ""
+    },
+    "imp": [
+      {
+        "id": "001",
+        "bidfloor": 1.429,
+        "tagid": "667",
+        "secure": 1,
+        "audio": {
+          "protocols": [
+            2,
+            3,
+            5,
+            6
+          ],
+          "mimes": [
+            "audio/mp4",
+            "audio/mp3"
+          ],
+          "api": [],
+          "minduration": 15,
+          "maxduration": 60,
+          "startdelay": -1
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "placement-id-1"
+          }
+        }
+      }
+    ],
+    "site": {
+      "domain": "https://test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "cur": [
+      "USD"
+    ],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 400
+  },
+  "httpCalls": [
+    {
+      "expectedRequest": {
+        "method": "POST",
+        "body": {
+          "imps": [
+            {
+              "bid_id": "12345",
+              "ext": {
+                "gpid": ""
+              },
+              "imp_id": "001",
+              "media_types": {
+                "banner": {
+                  "sizes": null,
+                  "mimes": null
+                },
+                "video": {
+                  "sizes": null,
+                  "mimes": null
+                },
+                "audio": {
+                  "sizes": null,
+                  "mimes": [
+                    "audio/mp4",
+                    "audio/mp3"
+                  ]
+                }
+              },
+              "zone_id": {
+                "placementId": "placement-id-1"
+              }
+            }
+          ],
+          "site": {
+            "domain": "https://test.com",
+            "referrer": "https://test.com/2016/06/12"
+          }
+        },
+        "impIDs": [
+          "001"
+        ]
+      },
+      "mockResponse": {
+        "status": 200,
+        "body": {
+          "bids": [
+            {
+              "bid_id": "01",
+              "imp_id": "001",
+              "cpm": 9.11,
+              "dealid": "RD-1000164",
+              "cid": "1000048-1002918",
+              "crid": "1003893",
+              "adid": "1003893",
+              "language": "en",
+              "w": "0",
+              "h": "0",
+              "seat": "resetdigital",
+              "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
+            }
+          ]
+        }
+      }
+    }
+  ],
+  "expectedBidResponses": [
+    {
+      "currency": "USD",
+      "bids": [
+        {
+          "bid": {
+            "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
+            "cid": "1000048-1002918",
+            "crid": "1003893",
+            "id": "01",
+            "impid": "001",
+            "price": 9.11
+          },
+          "type": "audio",
+          "seat": "resetdigital"
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
index bf22010c6fd..2e4a54c8a57 100644
--- a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
@@ -39,6 +39,7 @@
           "imp_id": "001",
           "media_types": {
             "banner": {
+              "mimes": null,
               "sizes": [
                 [
                   250,
@@ -47,6 +48,11 @@
               ]
             },
             "video": {
+              "mimes": null,
+              "sizes": null
+            },
+            "audio": {
+              "mimes": null,
               "sizes": null
             }
           },
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json
index 260217be957..0310ed18c46 100644
--- a/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json
@@ -1,9 +1,10 @@
 {
   "mockBidRequest": {
     "id": "12345",
-    "imp": [{
-      "id": "001",
-      "video": {
+    "imp": [
+      {
+        "id": "001",
+        "video": {
           "w": 900,
           "h": 250,
           "mimes": [
@@ -11,12 +12,13 @@
             "video/mp4"
           ]
         },
-      "ext": {
-        "bidder": {
-          "placement_id": "placement-id-1"
+        "ext": {
+          "bidder": {
+            "placement_id": "placement-id-1"
+          }
         }
       }
-    }],
+    ],
     "site": {
       "domain": "https://test.com",
       "page": "https://test.com/2016/06/12"
@@ -31,76 +33,94 @@
     },
     "tmax": 500
   },
-  "httpCalls": [{
-    "expectedRequest": {
-      "method": "POST",
-      "body": {
-        "imps": [{
-          "bid_id": "12345",
-          "ext": {
-            "gpid": ""
-          },
-          "imp_id": "001",
-          "media_types": {
-            "banner": {
-             "sizes": null
-            },
-            "video": {
-              "sizes": [
-                [
-                  900,
-                  250
-                ]
-              ]
+  "httpCalls": [
+    {
+      "expectedRequest": {
+        "method": "POST",
+        "body": {
+          "imps": [
+            {
+              "bid_id": "12345",
+              "ext": {
+                "gpid": ""
+              },
+              "imp_id": "001",
+              "media_types": {
+                "banner": {
+                  "mimes": null,
+                  "sizes": null
+                },
+                "video": {
+                  "sizes": [
+                    [
+                      900,
+                      250
+                    ]
+                  ],
+                  "mimes": [
+                    "video/x-flv",
+                    "video/mp4"
+                  ]
+                },
+                "audio": {
+                  "mimes": null,
+                  "sizes": null
+                }
+              },
+              "zone_id": {
+                "placementId": "placement-id-1"
+              }
             }
-          },
-          "zone_id": {
-            "placementId": "placement-id-1"
+          ],
+          "site": {
+            "domain": "https://test.com",
+            "referrer": "https://test.com/2016/06/12"
           }
-        }],
-        "site": {
-          "domain": "https://test.com",
-          "referrer": "https://test.com/2016/06/12"
-        }
+        },
+        "impIDs": [
+          "001"
+        ]
       },
-      "impIDs": [
-        "001"
-      ]
-    },
-    "mockResponse": {
-      "status": 200,
-      "body": {
-        "bids": [{
-          "bid_id": "01",
-          "imp_id": "001",
-          "cpm": 1.00,
-          "cid": "1002088",
-          "crid": "1000763-1002088",
-          "adid": "1002088",
-          "w": "900",
-          "h": "250",
-          "seat": "resetdigital",
-          "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
-        }]
+      "mockResponse": {
+        "status": 200,
+        "body": {
+          "bids": [
+            {
+              "bid_id": "01",
+              "imp_id": "001",
+              "cpm": 1.00,
+              "cid": "1002088",
+              "crid": "1000763-1002088",
+              "adid": "1002088",
+              "w": "900",
+              "h": "250",
+              "seat": "resetdigital",
+              "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
+            }
+          ]
+        }
       }
     }
-  }],
-
-  "expectedBidResponses": [{
-    "currency": "USD",
-    "bids": [{
-      "bid": {
-        "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
-        "cid": "1002088",
-        "crid": "1000763-1002088",
-        "id": "01",
-        "impid": "001",
-        "price": 1.00,
-        "w": 900,
-        "h": 250
-      },
-      "type": "video",
-      "seat": "resetdigital"
-    }]
-  }]
-}
+  ],
+  "expectedBidResponses": [
+    {
+      "currency": "USD",
+      "bids": [
+        {
+          "bid": {
+            "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
+            "cid": "1002088",
+            "crid": "1000763-1002088",
+            "id": "01",
+            "impid": "001",
+            "price": 1.00,
+            "w": 900,
+            "h": 250
+          },
+          "type": "video",
+          "seat": "resetdigital"
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json
index 6865ffc355c..fca85c84d4a 100644
--- a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json
@@ -33,6 +33,7 @@
             "imp_id": "001",
             "media_types": {
               "banner": {
+                "mimes": null,
                 "sizes": [
                   [
                     250,
@@ -41,6 +42,11 @@
                 ]
               },
               "video": {
+                "mimes": null,
+                "sizes": null
+              },
+              "audio": {
+                "mimes": null,
                 "sizes": null
               }
             },
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json
index d148516b1c2..878d9c07289 100644
--- a/adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json
@@ -35,6 +35,7 @@
               "imp_id": "001",
               "media_types": {
                 "banner": {
+                  "mimes": null,
                   "sizes": [
                     [
                       250,
@@ -43,6 +44,11 @@
                   ]
                 },
                 "video": {
+                  "mimes": null,
+                  "sizes": null
+                },
+                "audio": {
+                  "mimes": null,
                   "sizes": null
                 }
               },
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/invalid_video_dim.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_video_dim.json
similarity index 86%
rename from adapters/resetdigital/resetdigitaltest/exemplary/invalid_video_dim.json
rename to adapters/resetdigital/resetdigitaltest/supplemental/invalid_video_dim.json
index 6cbc6cf2be8..9a955ccb6a2 100644
--- a/adapters/resetdigital/resetdigitaltest/exemplary/invalid_video_dim.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_video_dim.json
@@ -44,9 +44,18 @@
             "imp_id": "001",
             "media_types": {
               "banner": {
-               "sizes": null
+                "mimes": null,
+                "sizes": null
               },
               "video": {
+                "sizes": null,
+                "mimes": [
+                  "video/x-flv",
+                  "video/mp4"
+                ]
+              },
+              "audio": {
+                "mimes": null,
                 "sizes": null
               }
             },
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json b/adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json
index f17e0d149ab..66a441f6506 100644
--- a/adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json
@@ -44,6 +44,7 @@
               "imp_id": "001",
               "media_types": {
                 "banner": {
+                  "mimes": null,
                   "sizes": [
                     [
                       300,
@@ -52,6 +53,11 @@
                   ]
                 },
                 "video": {
+                  "sizes": null,
+                  "mimes": null
+                },
+                "audio": {
+                  "mimes": null,
                   "sizes": null
                 }
               },
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json b/adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json
index 08cd3f22944..2d42bf5ddd4 100644
--- a/adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json
@@ -32,10 +32,16 @@
             "imp_id": "001",
             "media_types": {
               "banner": {
+                "mimes": null,
                 "sizes": null
               },
               "video": {
-                  "sizes": null
+                "mimes": null,
+                "sizes": null
+              },
+              "audio": {
+                "sizes": null,
+                "mimes": ["audio/mpeg"]
               }
             },
             "zone_id": {

From bc7caaf5bff37777d83bc7d1f93893f58d521061 Mon Sep 17 00:00:00 2001
From: Dirk Merkel <dirk@resetdigital.co>
Date: Mon, 4 Nov 2024 12:10:03 -0800
Subject: [PATCH 27/75] Fix slice append syntax.

---
 adapters/resetdigital/resetdigital.go | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 5f3f4b1b333..69f0fdd2375 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -46,7 +46,7 @@ type resetDigitalMediaTypes struct {
 }
 type resetDigitalMediaType struct {
 	Sizes [][]int64 `json:"sizes"`
-	Mimes []string `json:"mimes"`
+	Mimes []string  `json:"mimes"`
 }
 type resetDigitalBidResponse struct {
 	Bids []resetDigitalBid `json:"bids"`
@@ -179,15 +179,18 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 				[]int64{tempW, tempH},
 			)
 		}
-		if imp.Video.MIMEs != nil{
+		if imp.Video.MIMEs != nil {
+			// reqData.Imps[0].MediaTypes.Video.Mimes = imp.Video.MIMEs
 			reqData.Imps[0].MediaTypes.Video.Mimes = append(
-				imp.Video.MIMEs,
+				reqData.Imps[0].MediaTypes.Video.Mimes,
+				imp.Video.MIMEs...,
 			)
 		}
 	}
-	if bidType == openrtb_ext.BidTypeAudio && imp.Audio != nil && imp.Audio.MIMEs != nil{
+	if bidType == openrtb_ext.BidTypeAudio && imp.Audio != nil && imp.Audio.MIMEs != nil {
 		reqData.Imps[0].MediaTypes.Audio.Mimes = append(
-			imp.Audio.MIMEs,
+			reqData.Imps[0].MediaTypes.Audio.Mimes,
+			imp.Audio.MIMEs...,
 		)
 	}
 

From 4569e97ee89e98cc34184d299fd7f701d3edf040 Mon Sep 17 00:00:00 2001
From: Dirk Merkel <dirk@resetdigital.co>
Date: Mon, 4 Nov 2024 12:26:23 -0800
Subject: [PATCH 28/75] Removed zero check for bid response and moved HTTP
 headers into separate conditionals as requested by Brian Sardo.

---
 adapters/resetdigital/resetdigital.go | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 69f0fdd2375..3e56ed460bd 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -78,17 +78,25 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co
 func getHeaders(request *openrtb2.BidRequest) http.Header {
 	headers := http.Header{}
 
-	if request != nil && request.Device != nil && request.Site != nil { // what about request.App? Do we need to do something different with Referrer in the app case assuming we care about app?
+	addNonEmptyHeaders(&headers, map[string]string{
+		"Content-Type": "application/json;charset=utf-8",
+		"Accept":       "application/json",
+	})
+
+	if request != nil && request.Device != nil {
 		addNonEmptyHeaders(&headers, map[string]string{
-			"Referer":         request.Site.Page,
 			"Accept-Language": request.Device.Language,
 			"User-Agent":      request.Device.UA,
 			"X-Forwarded-For": request.Device.IP,
 			"X-Real-Ip":       request.Device.IP,
-			"Content-Type":    "application/json;charset=utf-8",
-			"Accept":          "application/json",
 		})
 	}
+	if request != nil && request.Site != nil {
+		addNonEmptyHeaders(&headers, map[string]string{
+			"Referer": request.Site.Page,
+		})
+	}
+
 	return headers
 }
 
@@ -263,10 +271,6 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R
 }
 
 func getBidFromResponse(bidResponse *resetDigitalBid) (*openrtb2.Bid, error) {
-	if bidResponse.CPM == 0 {
-		// brian to check how to report this
-		return nil, nil
-	}
 
 	bid := &openrtb2.Bid{
 		ID:    bidResponse.BidID,

From 0bc2aeb4b95964e9bed8d36f49dab11c2ab43458 Mon Sep 17 00:00:00 2001
From: Dirk Merkel <dirk@resetdigital.co>
Date: Mon, 4 Nov 2024 12:47:00 -0800
Subject: [PATCH 29/75] Adding test case for missing currency to improve test
 coverage percentage.

---
 .../supplemental/missing-currency.json        | 105 ++++++++++++++++++
 1 file changed, 105 insertions(+)
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/missing-currency.json

diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/missing-currency.json b/adapters/resetdigital/resetdigitaltest/supplemental/missing-currency.json
new file mode 100644
index 00000000000..35bf5f7165e
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/missing-currency.json
@@ -0,0 +1,105 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [{
+      "id": "001",
+      "banner": {
+        "h": 300,
+        "w": 250
+      },
+      "ext": {
+        "bidder": {
+          "placement_id": "placement-id-1"
+        }
+      }
+    }],
+    "site": {
+      "domain": "https://test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [{
+    "expectedRequest": {
+      "method": "POST",
+      "body": {
+        "imps": [{
+          "bid_id": "12345",
+          "ext": {
+            "gpid": ""
+          },
+          "imp_id": "001",
+          "media_types": {
+            "banner": {
+              "mimes": null,
+              "sizes": [
+                [
+                  250,
+                  300
+                ]
+              ]
+            },
+            "video": {
+              "mimes": null,
+              "sizes": null
+            },
+            "audio": {
+              "mimes": null,
+              "sizes": null
+            }
+          },
+          "zone_id": {
+            "placementId": "placement-id-1"
+          }
+        }],
+        "site": {
+          "domain": "https://test.com",
+          "referrer": "https://test.com/2016/06/12"
+        }
+      },
+      "impIDs": [
+        "001"
+      ]
+    },
+    "mockResponse": {
+      "status": 200,
+      "body": {
+        "bids": [{
+          "bid_id": "01",
+          "imp_id": "001",
+          "cpm": 1.00,
+          "cid": "1002088",
+          "crid": "1000763-1002088",
+          "adid": "1002088",
+          "w": "300",
+          "h": "250",
+          "seat": "resetdigital",
+          "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
+        }]
+      }
+    }
+  }],
+
+  "expectedBidResponses": [{
+    "currency": "USD",
+    "bids": [{
+      "bid": {
+        "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
+        "cid": "1002088",
+        "crid": "1000763-1002088",
+        "id": "01",
+        "impid": "001",
+        "price": 1.00,
+        "w": 300,
+        "h": 250
+      },
+      "type": "banner",
+      "seat": "resetdigital"
+    }]
+  }]
+}

From cff2442bed7f75aee6edb1c7119cb547b783f023 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Mon, 5 Feb 2024 17:54:37 +0000
Subject: [PATCH 30/75] New Adapter: ResetDigital

---
 adapters/resetdigital/resetdigital.go         | 260 ++++++++++++++++++
 adapters/resetdigital/resetdigital_test.go    |  87 ++++++
 .../examplary/simple-banner.json              |  87 ++++++
 openrtb_ext/bidders.go                        |   2 +
 openrtb_ext/imp_resetdigital.go               |   7 +
 5 files changed, 443 insertions(+)
 create mode 100644 adapters/resetdigital/resetdigital.go
 create mode 100644 adapters/resetdigital/resetdigital_test.go
 create mode 100644 adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
 create mode 100644 openrtb_ext/imp_resetdigital.go

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
new file mode 100644
index 00000000000..7e44bfd8607
--- /dev/null
+++ b/adapters/resetdigital/resetdigital.go
@@ -0,0 +1,260 @@
+package resetdigital
+
+import (
+	"encoding/json"
+	"fmt"
+	"net/http"
+	"strconv"
+	"text/template"
+
+	"github.com/prebid/openrtb/v20/openrtb2"
+	"github.com/prebid/prebid-server/v2/adapters"
+	"github.com/prebid/prebid-server/v2/config"
+	"github.com/prebid/prebid-server/v2/openrtb_ext"
+)
+
+// MaximumBids is the maximum number of bids that can be returned by this adapter.
+const (
+	MaxBids = 1
+)
+
+type adapter struct {
+	endpoint    *template.Template
+	endpointUri string
+}
+
+type resetDigitalRequest struct {
+	Site resetDigitalRequestSite  `json:"site"`
+	Imps []resetDigitalRequesImps `json:"imps"`
+}
+
+type resetDigitalRequestSite struct {
+	Domain   string `json:"domain"`
+	Referrer string `json:"referrer"`
+}
+
+type resetDigitalRequesImps struct {
+	ZoneID struct {
+		PlacementID string `json:"placementId"`
+	} `json:"zone_id"`
+	BidID string `json:"bid_id"`
+	ImpID string `json:"imp_id"`
+	Ext   struct {
+		Gpid string `json:"gpid"`
+	} `json:"ext"`
+	Sizes      [][]int64 `json:"sizes"`
+	MediaTypes struct {
+		Banner struct {
+			Sizes [][]int64 `json:"sizes"`
+		} `json:"banner"`
+		Video struct {
+			Sizes [][]int64 `json:"sizes"`
+		} `json:"video"`
+	} `json:"media_types"`
+}
+
+func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) {
+	template, err := template.New("endpointTemplate").Parse(config.Endpoint)
+	if err != nil {
+		return nil, fmt.Errorf("unable to parse endpoint url template: %v", err)
+	}
+
+	bidder := &adapter{
+		endpoint: template,
+	}
+
+	return bidder, nil
+}
+func getHeaders(request *openrtb2.BidRequest) http.Header {
+	headers := http.Header{}
+
+	if request.Device != nil && request.Site != nil {
+		addNonEmptyHeaders(&headers, map[string]string{
+			"Referer":         request.Site.Page,
+			"Accept-Language": request.Device.Language,
+			"User-Agent":      request.Device.UA,
+			"X-Forwarded-For": request.Device.IP,
+			"X-Real-Ip":       request.Device.IP,
+			"Content-Type":    "application/json;charset=utf-8",
+			"Accept":          "application/json",
+		})
+	}
+
+	return headers
+}
+func addNonEmptyHeaders(headers *http.Header, headerValues map[string]string) {
+	for key, value := range headerValues {
+		if len(value) > 0 {
+			headers.Add(key, value)
+		}
+	}
+}
+
+func getReferer(request *openrtb2.BidRequest) string {
+	if request.Site == nil {
+		return ""
+	}
+
+	return request.Site.Domain
+}
+
+func getCurrency(request *openrtb2.BidRequest) string {
+	if len(request.Cur) == 0 {
+		return "USD"
+	}
+
+	return request.Cur[0]
+}
+
+func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {
+	var (
+		requests []*adapters.RequestData
+		errors   []error
+	)
+
+	referer := getReferer(requestData)
+	currency := getCurrency(requestData)
+
+	if referer == currency {
+		return nil, nil
+	}
+
+	for i := range requestData.Imp {
+		imp := requestData.Imp[i]
+		bidType, err := getBidType(imp)
+
+		if err != nil {
+			errors = append(errors, err)
+			continue
+		}
+
+		splittedRequestData := processDataFromRequest(requestData, imp, bidType)
+
+		requestBody, err := json.Marshal(splittedRequestData)
+		if err != nil {
+			errors = append(errors, err)
+			continue
+		}
+
+		requests = append(requests, &adapters.RequestData{
+			Method:  "POST",
+			Uri:     a.endpointUri,
+			Body:    requestBody,
+			Headers: getHeaders(requestData),
+		})
+	}
+
+	return requests, errors
+}
+
+func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp, bidType openrtb_ext.BidType) resetDigitalRequest {
+
+	var resetDigitalRequestData resetDigitalRequest
+	resetDigitalRequestData.Site.Domain = requestData.Site.Domain
+	resetDigitalRequestData.Site.Referrer = requestData.Site.Page
+
+	resetDigitalRequestData.Imps = append(resetDigitalRequestData.Imps, resetDigitalRequesImps{})
+	resetDigitalRequestData.Imps[0].BidID = requestData.ID
+	resetDigitalRequestData.Imps[0].ImpID = imp.ID
+
+	if bidType == openrtb_ext.BidTypeBanner {
+		resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes = append(resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes, []int64{imp.Banner.Format[0].W, imp.Banner.Format[0].H})
+	}
+	if bidType == openrtb_ext.BidTypeVideo {
+		resetDigitalRequestData.Imps[0].MediaTypes.Video.Sizes = append(resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes, []int64{*imp.Video.W, *imp.Video.H})
+	}
+
+	return resetDigitalRequestData
+
+}
+
+func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) {
+	if response.StatusCode == http.StatusNoContent {
+		return nil, nil
+	}
+	if response.StatusCode == http.StatusBadRequest {
+		return nil, []error{fmt.Errorf("bad request")}
+	}
+	if response.StatusCode != http.StatusOK {
+		return nil, []error{fmt.Errorf("unexpected status code: %d", response.StatusCode)}
+	}
+
+	if err := json.Unmarshal(response.Body, &response); err != nil {
+		return nil, []error{err}
+	}
+	bidResponse := adapters.NewBidderResponseWithBidsCapacity(MaxBids)
+	//check no bids
+	jsonData := make(map[string]interface{})
+
+	json.Unmarshal([]byte(response.Body), &jsonData)
+	//Always one bid
+	bid := getBidFromResponse(jsonData)
+
+	bidType, err := getBidType(internalRequest.Imp[0])
+	if err != nil {
+		// handle error
+		return nil, []error{err}
+	}
+	bidResponse.Currency = getCurrency(internalRequest)
+	bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{
+		Bid:     bid,
+		BidType: bidType,
+	})
+
+	return bidResponse, nil
+}
+
+func getBidFromResponse(requestData map[string]interface{}) *openrtb2.Bid {
+	processData := requestData["bids"].([]interface{})[0].(map[string]interface{})
+	fmt.Printf("jsonData: %v\n", processData)
+
+	bid := &openrtb2.Bid{
+		ID:    processData["bid_id"].(string),
+		Price: getBidPrice(processData),
+		ImpID: processData["imp_id"].(string),
+		CrID:  processData["crid"].(string),
+	}
+	//if HTML is filled on jsonData then fill ADM with it
+	if value, ok := processData["html"].(string); ok {
+		bid.AdM = value
+	}
+	//if Width and Height are filled on jsonData then fill W and H with it
+	if value, ok := processData["w"].(string); ok {
+
+		i, _ := strconv.ParseInt(value, 10, 64)
+		if i > 0 {
+			bid.W = i
+		}
+	}
+	if value, ok := processData["h"].(string); ok {
+		i, _ := strconv.ParseInt(value, 10, 64)
+		if i > 0 {
+			bid.H = i
+		}
+	}
+	//if Bid Price is 0 then return nil
+	if bid.Price == 0 {
+		return nil
+	}
+
+	return bid
+}
+
+func getBidPrice(requestData map[string]interface{}) float64 {
+	if value, ok := requestData["cpm"].(float64); ok {
+		return value
+	}
+	return 0.0 // Default value if "cpm" doesn't exist or is not a float64
+}
+
+func getBidType(imp openrtb2.Imp) (openrtb_ext.BidType, error) {
+	if imp.Banner != nil {
+		return openrtb_ext.BidTypeBanner, nil
+	} else if imp.Video != nil {
+		return openrtb_ext.BidTypeVideo, nil
+	} else if imp.Audio != nil {
+		return openrtb_ext.BidTypeAudio, nil
+	}
+
+	return "", fmt.Errorf("failed to find matching imp for bid %s", imp.ID)
+}
diff --git a/adapters/resetdigital/resetdigital_test.go b/adapters/resetdigital/resetdigital_test.go
new file mode 100644
index 00000000000..e3307e916cf
--- /dev/null
+++ b/adapters/resetdigital/resetdigital_test.go
@@ -0,0 +1,87 @@
+package resetdigital
+
+import (
+	"encoding/json"
+	"net/http"
+	"testing"
+
+	"github.com/prebid/openrtb/v20/openrtb2"
+	"github.com/prebid/prebid-server/v2/adapters"
+	"github.com/stretchr/testify/assert"
+)
+
+func TestMakeRequests(t *testing.T) {
+	bidder := new(adapter)
+
+	request := &openrtb2.BidRequest{
+		ID: "12345",
+
+		Imp: []openrtb2.Imp{{
+			ID: "001",
+
+			Banner: &openrtb2.Banner{
+				Format: []openrtb2.Format{
+					{W: 300, H: 250},
+				},
+			},
+			Ext: json.RawMessage(``),
+		}},
+		Site: &openrtb2.Site{
+			Domain: "https://test.com",
+			Page:   "https://test.com/2016/06/12",
+		},
+		Cur: []string{"USD"},
+		Device: &openrtb2.Device{
+			UA:       "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+			IP:       "127.0.0.1",
+			Language: "EN",
+		},
+	}
+
+	reqs, errs := bidder.MakeRequests(request, &adapters.ExtraRequestInfo{})
+
+	assert.Empty(t, errs, "Got unexpected errors while building HTTP requests: %v", errs)
+	assert.Equal(t, 1, len(reqs), "Unexpected number of HTTP requests. Got %d. Expected %d", len(reqs), 1)
+}
+
+func TestMakeBids(t *testing.T) {
+	request := &openrtb2.BidRequest{
+		ID: "test-request-id",
+		Imp: []openrtb2.Imp{{
+			ID: "test-imp-id",
+			Banner: &openrtb2.Banner{
+				Format: []openrtb2.Format{{
+					W: 320,
+					H: 250,
+				}},
+			},
+			Ext: json.RawMessage(`{"bidder": {
+				"accountId": 2763,
+				"siteId": 68780,
+				"zoneId": 327642
+			}}`),
+		}},
+		Ext: json.RawMessage(``),
+	}
+
+	requestJson, _ := json.Marshal(request)
+	reqData := &adapters.RequestData{
+		Method:  "POST",
+		Uri:     "test-uri",
+		Body:    requestJson,
+		Headers: nil,
+	}
+
+	httpResp := &adapters.ResponseData{
+		StatusCode: http.StatusOK,
+		Body:       []byte(`{"bids":[{"bid_id":"01","imp_id":"001","cpm":10.00,"cid":"1002088","crid":"1000763-1002088","adid":"1002088","w":"300","h":"250","seat":"resetdigital","html":"<scriptsrc=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-15&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\"type=\"text/javascript\"></script><imagesrc='https://adsreq.resetdigital.co?brid=0000000000000001'/><imagesrc='https://sync2.resetdigital.co/hbsync?ck=0000000000000001'/>"}]}`),
+	}
+
+	bidder := new(adapter)
+	bidResponse, errs := bidder.MakeBids(request, reqData, httpResp)
+
+	assert.Empty(t, errs, "Expected 0 errors. Got %d", len(errs))
+
+	assert.Equal(t, float64(10), bidResponse.Bids[0].Bid.Price,
+		"Expected Price 10. Got: %s", bidResponse.Bids[0].Bid.Price)
+}
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json b/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
new file mode 100644
index 00000000000..4e21c27015a
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
@@ -0,0 +1,87 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [
+      {
+        "id": "001",
+        "banner": {
+          "w": 300,
+          "h": 250
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "111"
+          }
+        }
+      }
+    ],
+    "site": {
+      "domain": "https://test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "cur": [
+      "USD"
+    ],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [
+    {
+      "language": "en-US",
+      "site": {
+        "domain": "https://test.com",
+        "referrer": "https://test.com/2016/06/12"
+      },
+      "imps": [
+        {
+          "zone_id": {
+            "placementId": "test"
+          },
+          "bid_id": "01",
+          "imp_id": "001",
+          "ext": {
+            "gpid": "test"
+          },
+          "sizes": [
+            [
+              300,
+              250
+            ]
+          ],
+          "media_types": {
+            "banner": {
+              "sizes": [
+                [
+                  300,
+                  250
+                ]
+              ]
+            }
+          }
+        }
+      ]
+    }
+  ],
+  "expectedBidResponses": [
+    {
+      "bids": [
+          {
+              "bid_id": "01",
+              "imp_id": "001",
+              "cpm": 1.00,
+              "cid": "1002088",
+              "crid": "1000763-1002088",
+              "adid": "1002088",
+              "w": "300",
+              "h": "250",
+              "seat": "resetdigital",
+              "html": "<script  />"
+          }
+      ]
+  }
+  ]
+}
\ No newline at end of file
diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go
index f7706ce5c25..68b3c1d241e 100644
--- a/openrtb_ext/bidders.go
+++ b/openrtb_ext/bidders.go
@@ -182,6 +182,7 @@ var coreBidderNames []BidderName = []BidderName{
 	BidderQT,
 	BidderReadpeak,
 	BidderRelevantDigital,
+	BidderResetDigital,
 	BidderRevcontent,
 	BidderRichaudience,
 	BidderRise,
@@ -511,6 +512,7 @@ const (
 	BidderQT                BidderName = "qt"
 	BidderReadpeak          BidderName = "readpeak"
 	BidderRelevantDigital   BidderName = "relevantdigital"
+	BidderResetDigital      BidderName = "resetdigital"
 	BidderRevcontent        BidderName = "revcontent"
 	BidderRichaudience      BidderName = "richaudience"
 	BidderRise              BidderName = "rise"
diff --git a/openrtb_ext/imp_resetdigital.go b/openrtb_ext/imp_resetdigital.go
new file mode 100644
index 00000000000..005b524dfb5
--- /dev/null
+++ b/openrtb_ext/imp_resetdigital.go
@@ -0,0 +1,7 @@
+package openrtb_ext
+
+type ExtResetDigital struct {
+	cid  string `json:"bid_id"`
+	crid string `json:"imp_id"`
+	adid string `json:"adid"`
+}

From 44bee695145620f3096f60b624bf17370126152d Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Wed, 7 Feb 2024 17:21:56 +0000
Subject: [PATCH 31/75] Fix to have the a bid forced on testing

---
 adapters/resetdigital/resetdigital.go           | 17 ++++++++++++++++-
 adapters/resetdigital/resetdigital_test.go      |  4 ++--
 .../examplary/simple-banner.json                |  3 ++-
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 7e44bfd8607..b3c48506465 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -34,7 +34,8 @@ type resetDigitalRequestSite struct {
 }
 
 type resetDigitalRequesImps struct {
-	ZoneID struct {
+	ForceBid bool `json:"force_bid"`
+	ZoneID   struct {
 		PlacementID string `json:"placementId"`
 	} `json:"zone_id"`
 	BidID string `json:"bid_id"`
@@ -157,6 +158,8 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 	resetDigitalRequestData.Imps[0].BidID = requestData.ID
 	resetDigitalRequestData.Imps[0].ImpID = imp.ID
 
+	var err error
+
 	if bidType == openrtb_ext.BidTypeBanner {
 		resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes = append(resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes, []int64{imp.Banner.Format[0].W, imp.Banner.Format[0].H})
 	}
@@ -164,6 +167,18 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 		resetDigitalRequestData.Imps[0].MediaTypes.Video.Sizes = append(resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes, []int64{*imp.Video.W, *imp.Video.H})
 	}
 
+	var extData = make(map[string]interface{})
+	err = json.Unmarshal(imp.Ext, &extData)
+	if err != nil {
+
+	} else {
+
+		resetDigitalRequestData.Imps[0].ZoneID.PlacementID = extData["bidder"].(map[string]interface{})["placement_id"].(string)
+		if resetDigitalRequestData.Imps[0].ZoneID.PlacementID == "test" {
+			resetDigitalRequestData.Imps[0].ForceBid = true
+		}
+
+	}
 	return resetDigitalRequestData
 
 }
diff --git a/adapters/resetdigital/resetdigital_test.go b/adapters/resetdigital/resetdigital_test.go
index e3307e916cf..22a19dd5865 100644
--- a/adapters/resetdigital/resetdigital_test.go
+++ b/adapters/resetdigital/resetdigital_test.go
@@ -18,13 +18,13 @@ func TestMakeRequests(t *testing.T) {
 
 		Imp: []openrtb2.Imp{{
 			ID: "001",
-
 			Banner: &openrtb2.Banner{
 				Format: []openrtb2.Format{
 					{W: 300, H: 250},
 				},
 			},
-			Ext: json.RawMessage(``),
+
+			Ext: json.RawMessage(`{"bidder": {"placement_id": "test"}}`), //Placement_id test is used to get the force bid true
 		}},
 		Site: &openrtb2.Site{
 			Domain: "https://test.com",
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json b/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
index 4e21c27015a..20e768c675d 100644
--- a/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
+++ b/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
@@ -10,7 +10,7 @@
         },
         "ext": {
           "bidder": {
-            "placement_id": "111"
+            "placement_id": "test"
           }
         }
       }
@@ -38,6 +38,7 @@
       },
       "imps": [
         {
+          "force_bid" : 1,
           "zone_id": {
             "placementId": "test"
           },

From 96fde76c1f6c20a7fe7d8763aa6b511ea4f8d45e Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Fri, 9 Feb 2024 12:23:22 +0000
Subject: [PATCH 32/75] Test changes

---
 adapters/resetdigital/resetdigital.go      |  5 ++-
 adapters/resetdigital/resetdigital_test.go | 37 ++++++++++++----------
 2 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index b3c48506465..3f359097c7c 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -188,10 +188,10 @@ func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest
 		return nil, nil
 	}
 	if response.StatusCode == http.StatusBadRequest {
-		return nil, []error{fmt.Errorf("bad request")}
+		return nil, nil
 	}
 	if response.StatusCode != http.StatusOK {
-		return nil, []error{fmt.Errorf("unexpected status code: %d", response.StatusCode)}
+		return nil, nil
 	}
 
 	if err := json.Unmarshal(response.Body, &response); err != nil {
@@ -221,7 +221,6 @@ func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest
 
 func getBidFromResponse(requestData map[string]interface{}) *openrtb2.Bid {
 	processData := requestData["bids"].([]interface{})[0].(map[string]interface{})
-	fmt.Printf("jsonData: %v\n", processData)
 
 	bid := &openrtb2.Bid{
 		ID:    processData["bid_id"].(string),
diff --git a/adapters/resetdigital/resetdigital_test.go b/adapters/resetdigital/resetdigital_test.go
index 22a19dd5865..0e31466503a 100644
--- a/adapters/resetdigital/resetdigital_test.go
+++ b/adapters/resetdigital/resetdigital_test.go
@@ -46,30 +46,35 @@ func TestMakeRequests(t *testing.T) {
 
 func TestMakeBids(t *testing.T) {
 	request := &openrtb2.BidRequest{
-		ID: "test-request-id",
+		ID: "12345",
+
 		Imp: []openrtb2.Imp{{
-			ID: "test-imp-id",
+			ID: "001",
 			Banner: &openrtb2.Banner{
-				Format: []openrtb2.Format{{
-					W: 320,
-					H: 250,
-				}},
+				Format: []openrtb2.Format{
+					{W: 300, H: 250},
+				},
 			},
-			Ext: json.RawMessage(`{"bidder": {
-				"accountId": 2763,
-				"siteId": 68780,
-				"zoneId": 327642
-			}}`),
+
+			Ext: json.RawMessage(`{"bidder": {"placement_id": "test"}}`), //Placement_id test is used to get the force bid true
 		}},
-		Ext: json.RawMessage(``),
+		Site: &openrtb2.Site{
+			Domain: "https://test.com",
+			Page:   "https://test.com/2016/06/12",
+		},
+		Cur: []string{"USD"},
+		Device: &openrtb2.Device{
+			UA:       "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+			IP:       "127.0.0.1",
+			Language: "EN",
+		},
 	}
 
 	requestJson, _ := json.Marshal(request)
 	reqData := &adapters.RequestData{
-		Method:  "POST",
-		Uri:     "test-uri",
-		Body:    requestJson,
-		Headers: nil,
+		Method: "POST",
+		Uri:    "test-uri",
+		Body:   requestJson,
 	}
 
 	httpResp := &adapters.ResponseData{

From 6e08b5df3e1267333f98960bed2b9c0c5929db72 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Wed, 28 Feb 2024 10:28:57 +0000
Subject: [PATCH 33/75] Add file

---
 static/bidder-info/resetdigital.yaml | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 static/bidder-info/resetdigital.yaml

diff --git a/static/bidder-info/resetdigital.yaml b/static/bidder-info/resetdigital.yaml
new file mode 100644
index 00000000000..885916d0d8d
--- /dev/null
+++ b/static/bidder-info/resetdigital.yaml
@@ -0,0 +1,21 @@
+adapters:
+  resetdigital:
+    endpoint: http://b-us-east14.resetdigital.co:9001
+    meta-info:
+      maintainer-email: biddersupport@resetdigital.co
+      app-media-types:
+        - banner
+        - video
+        - audio
+      site-media-types:
+        - banner
+        - video
+        - audio
+      supported-vendors:
+      vendor-id: 1162
+    usersync:
+      cookie-family-name: resetdigital
+      redirect:
+        url: https://sync.resetdigital.co/csync?pid=rubicon&redir={{redirect_url}}
+        support-cors: false
+        uid-macro: '$USER_ID'

From ec4005d4187fef363d17723ae9b4a54d3fa8ad31 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Wed, 28 Feb 2024 10:46:23 +0000
Subject: [PATCH 34/75] Added schema for adapter

---
 static/bidder-params/resetdigital.json | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 static/bidder-params/resetdigital.json

diff --git a/static/bidder-params/resetdigital.json b/static/bidder-params/resetdigital.json
new file mode 100644
index 00000000000..d52cce3d8fa
--- /dev/null
+++ b/static/bidder-params/resetdigital.json
@@ -0,0 +1,8 @@
+{
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "title": "Relevant Digital Adapter Params",
+    "description": "A schema which validates params accepted by the Relevant Digital adapter",
+    "type": "object",
+    "properties": {},
+    "required": []
+}

From fd3ec0df07363d44fbac1509f260956779815a39 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Mon, 18 Mar 2024 18:00:03 +0000
Subject: [PATCH 35/75] Unused builder removed

---
 adapters/resetdigital/resetdigital.go | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 3f359097c7c..cf068e03d7a 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -9,7 +9,6 @@ import (
 
 	"github.com/prebid/openrtb/v20/openrtb2"
 	"github.com/prebid/prebid-server/v2/adapters"
-	"github.com/prebid/prebid-server/v2/config"
 	"github.com/prebid/prebid-server/v2/openrtb_ext"
 )
 
@@ -54,18 +53,6 @@ type resetDigitalRequesImps struct {
 	} `json:"media_types"`
 }
 
-func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) {
-	template, err := template.New("endpointTemplate").Parse(config.Endpoint)
-	if err != nil {
-		return nil, fmt.Errorf("unable to parse endpoint url template: %v", err)
-	}
-
-	bidder := &adapter{
-		endpoint: template,
-	}
-
-	return bidder, nil
-}
 func getHeaders(request *openrtb2.BidRequest) http.Header {
 	headers := http.Header{}
 

From 8bca6ade1463946ea43fb0e61d2d7653ff0c1d93 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Sun, 24 Mar 2024 19:28:11 +0000
Subject: [PATCH 36/75] Fix to lack of builder

---
 adapters/resetdigital/resetdigital.go | 13 +++++++++++++
 exchange/adapter_builders.go          |  1 +
 2 files changed, 14 insertions(+)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index cf068e03d7a..3f359097c7c 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -9,6 +9,7 @@ import (
 
 	"github.com/prebid/openrtb/v20/openrtb2"
 	"github.com/prebid/prebid-server/v2/adapters"
+	"github.com/prebid/prebid-server/v2/config"
 	"github.com/prebid/prebid-server/v2/openrtb_ext"
 )
 
@@ -53,6 +54,18 @@ type resetDigitalRequesImps struct {
 	} `json:"media_types"`
 }
 
+func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) {
+	template, err := template.New("endpointTemplate").Parse(config.Endpoint)
+	if err != nil {
+		return nil, fmt.Errorf("unable to parse endpoint url template: %v", err)
+	}
+
+	bidder := &adapter{
+		endpoint: template,
+	}
+
+	return bidder, nil
+}
 func getHeaders(request *openrtb2.BidRequest) http.Header {
 	headers := http.Header{}
 
diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go
index 67e28286f03..62c143d941a 100755
--- a/exchange/adapter_builders.go
+++ b/exchange/adapter_builders.go
@@ -397,6 +397,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder {
 		openrtb_ext.BidderReadpeak:          readpeak.Builder,
 		openrtb_ext.BidderRelevantDigital:   relevantdigital.Builder,
 		openrtb_ext.BidderRevcontent:        revcontent.Builder,
+		openrtb_ext.BidderResetDigital:      resetdigital.Builder,
 		openrtb_ext.BidderRichaudience:      richaudience.Builder,
 		openrtb_ext.BidderRise:              rise.Builder,
 		openrtb_ext.BidderRoulax:            roulax.Builder,

From 278be3f6dcb205fb60be4acfe3f7faa47c244af4 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Tue, 26 Mar 2024 21:40:07 +0000
Subject: [PATCH 37/75] Change of data on export

---
 openrtb_ext/imp_resetdigital.go | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/openrtb_ext/imp_resetdigital.go b/openrtb_ext/imp_resetdigital.go
index 005b524dfb5..b9e2ac8297b 100644
--- a/openrtb_ext/imp_resetdigital.go
+++ b/openrtb_ext/imp_resetdigital.go
@@ -1,7 +1,6 @@
 package openrtb_ext
 
 type ExtResetDigital struct {
-	cid  string `json:"bid_id"`
-	crid string `json:"imp_id"`
-	adid string `json:"adid"`
+	BidID string `json:"bid_id"`
+	ImpID string `json:"imp_id"`
 }

From 56a77a0a7cba3e70c9447f26ed9ad92b9394d8b1 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Sun, 14 Apr 2024 22:35:37 +0100
Subject: [PATCH 38/75] no need to include `required` if its empty

              no need to include `required` if its empty

_Originally posted by @onkarvhanumante in https://github.com/prebid/prebid-server/pull/3452#discussion_r1553484661_
---
 static/bidder-params/resetdigital.json | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/static/bidder-params/resetdigital.json b/static/bidder-params/resetdigital.json
index d52cce3d8fa..d2bcfb6bb5f 100644
--- a/static/bidder-params/resetdigital.json
+++ b/static/bidder-params/resetdigital.json
@@ -3,6 +3,5 @@
     "title": "Relevant Digital Adapter Params",
     "description": "A schema which validates params accepted by the Relevant Digital adapter",
     "type": "object",
-    "properties": {},
-    "required": []
+    "properties": {}
 }

From f0e25746748a0c8dc0b2f953012c5648eb8df712 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <b.jacinto@gmail.com>
Date: Tue, 14 May 2024 18:27:49 +0100
Subject: [PATCH 39/75] Resolving
 https://github.com/prebid/prebid-server/pull/3452

---
 static/bidder-info/resetdigital.yaml | 2 --
 1 file changed, 2 deletions(-)

diff --git a/static/bidder-info/resetdigital.yaml b/static/bidder-info/resetdigital.yaml
index 885916d0d8d..99c22378318 100644
--- a/static/bidder-info/resetdigital.yaml
+++ b/static/bidder-info/resetdigital.yaml
@@ -1,5 +1,3 @@
-adapters:
-  resetdigital:
     endpoint: http://b-us-east14.resetdigital.co:9001
     meta-info:
       maintainer-email: biddersupport@resetdigital.co

From 0e365ce2d2ace6f21bb15b0bd737e875b79330b2 Mon Sep 17 00:00:00 2001
From: bruno-sira <bruno@siira.world>
Date: Wed, 3 Jul 2024 14:57:57 +0100
Subject: [PATCH 40/75] New Adapter: ResetDigital #3766

Implementation of suggestions
---
 adapters/resetdigital/resetdigital.go | 93 ++++++++++++++++-----------
 1 file changed, 55 insertions(+), 38 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 3f359097c7c..c2ec6d10b95 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -184,69 +184,67 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 }
 
 func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) {
-	if response.StatusCode == http.StatusNoContent {
-		return nil, nil
-	}
-	if response.StatusCode == http.StatusBadRequest {
-		return nil, nil
-	}
-	if response.StatusCode != http.StatusOK {
+	if response.StatusCode == http.StatusNoContent || response.StatusCode == http.StatusBadRequest || response.StatusCode != http.StatusOK {
 		return nil, nil
 	}
 
-	if err := json.Unmarshal(response.Body, &response); err != nil {
+	var bidResp map[string]interface{}
+	if err := json.Unmarshal(response.Body, &bidResp); err != nil {
 		return nil, []error{err}
 	}
+
 	bidResponse := adapters.NewBidderResponseWithBidsCapacity(MaxBids)
-	//check no bids
-	jsonData := make(map[string]interface{})
+	jsonData := bidResp["bids"].([]interface{})
+
+	for _, bidData := range jsonData {
+		bidMap := bidData.(map[string]interface{})
+		bid := getBidFromResponse(bidMap)
+		if bid == nil {
+			continue
+		}
 
-	json.Unmarshal([]byte(response.Body), &jsonData)
-	//Always one bid
-	bid := getBidFromResponse(jsonData)
+		bidTypes, err := getBidTypes(internalRequest.Imp[0])
+		if err != nil {
+			return nil, []error{err}
+		}
 
-	bidType, err := getBidType(internalRequest.Imp[0])
-	if err != nil {
-		// handle error
-		return nil, []error{err}
+		for _, bidType := range bidTypes {
+			bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{
+				Bid:     bid,
+				BidType: bidType,
+			})
+		}
 	}
-	bidResponse.Currency = getCurrency(internalRequest)
-	bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{
-		Bid:     bid,
-		BidType: bidType,
-	})
 
+	bidResponse.Currency = getCurrency(internalRequest)
 	return bidResponse, nil
 }
-
 func getBidFromResponse(requestData map[string]interface{}) *openrtb2.Bid {
-	processData := requestData["bids"].([]interface{})[0].(map[string]interface{})
+	processData := requestData["bid_id"].(string)
 
 	bid := &openrtb2.Bid{
-		ID:    processData["bid_id"].(string),
-		Price: getBidPrice(processData),
-		ImpID: processData["imp_id"].(string),
-		CrID:  processData["crid"].(string),
+		ID:    processData,
+		Price: getBidPrice(requestData),
+		ImpID: requestData["imp_id"].(string),
+		CrID:  requestData["crid"].(string),
 	}
-	//if HTML is filled on jsonData then fill ADM with it
-	if value, ok := processData["html"].(string); ok {
+
+	if value, ok := requestData["html"].(string); ok {
 		bid.AdM = value
 	}
-	//if Width and Height are filled on jsonData then fill W and H with it
-	if value, ok := processData["w"].(string); ok {
 
-		i, _ := strconv.ParseInt(value, 10, 64)
-		if i > 0 {
+	if value, ok := requestData["w"].(string); ok {
+		if i, err := strconv.ParseInt(value, 10, 64); err == nil && i > 0 {
 			bid.W = i
 		}
 	}
-	if value, ok := processData["h"].(string); ok {
-		i, _ := strconv.ParseInt(value, 10, 64)
-		if i > 0 {
+
+	if value, ok := requestData["h"].(string); ok {
+		if i, err := strconv.ParseInt(value, 10, 64); err == nil && i > 0 {
 			bid.H = i
 		}
 	}
-	//if Bid Price is 0 then return nil
+
 	if bid.Price == 0 {
 		return nil
 	}
@@ -272,3 +270,22 @@ func getBidType(imp openrtb2.Imp) (openrtb_ext.BidType, error) {
 
 	return "", fmt.Errorf("failed to find matching imp for bid %s", imp.ID)
 }
+
+func getBidTypes(imp openrtb2.Imp) ([]openrtb_ext.BidType, error) {
+	var bidTypes []openrtb_ext.BidType
+
+	if imp.Banner != nil {
+		bidTypes = append(bidTypes, openrtb_ext.BidTypeBanner)
+	}
+	if imp.Video != nil {
+		bidTypes = append(bidTypes, openrtb_ext.BidTypeVideo)
+	}
+	if imp.Audio != nil {
+		bidTypes = append(bidTypes, openrtb_ext.BidTypeAudio)
+	}
+	if len(bidTypes) == 0 {
+		return nil, fmt.Errorf("failed to find matching imp for bid %s", imp.ID)
+	}
+
+	return bidTypes, nil
+}
\ No newline at end of file

From f2d3afceaa273a7184798dbb20e60219a41f4d74 Mon Sep 17 00:00:00 2001
From: bruno-sira <bruno@siira.world>
Date: Fri, 5 Jul 2024 16:56:32 +0100
Subject: [PATCH 41/75] Fix naming

---
 adapters/resetdigital/resetdigital.go | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index c2ec6d10b95..002447a60a3 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -24,8 +24,8 @@ type adapter struct {
 }
 
 type resetDigitalRequest struct {
-	Site resetDigitalRequestSite  `json:"site"`
-	Imps []resetDigitalRequesImps `json:"imps"`
+	Site resetDigitalRequestSite   `json:"site"`
+	Imps []resetDigitalRequestImps `json:"imps"`
 }
 
 type resetDigitalRequestSite struct {
@@ -33,7 +33,7 @@ type resetDigitalRequestSite struct {
 	Referrer string `json:"referrer"`
 }
 
-type resetDigitalRequesImps struct {
+type resetDigitalRequestImps struct {
 	ForceBid bool `json:"force_bid"`
 	ZoneID   struct {
 		PlacementID string `json:"placementId"`
@@ -154,7 +154,7 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 	resetDigitalRequestData.Site.Domain = requestData.Site.Domain
 	resetDigitalRequestData.Site.Referrer = requestData.Site.Page
 
-	resetDigitalRequestData.Imps = append(resetDigitalRequestData.Imps, resetDigitalRequesImps{})
+	resetDigitalRequestData.Imps = append(resetDigitalRequestData.Imps, resetDigitalRequestImps{})
 	resetDigitalRequestData.Imps[0].BidID = requestData.ID
 	resetDigitalRequestData.Imps[0].ImpID = imp.ID
 
@@ -288,4 +288,4 @@ func getBidTypes(imp openrtb2.Imp) ([]openrtb_ext.BidType, error) {
 	}
 
 	return bidTypes, nil
-}
\ No newline at end of file
+}

From d6e24d0c586d40ffe57976e174065f2ce29fba0b Mon Sep 17 00:00:00 2001
From: bruno-sira <bruno@siira.world>
Date: Fri, 5 Jul 2024 17:01:01 +0100
Subject: [PATCH 42/75] Fix naming of Var

---
 adapters/resetdigital/resetdigital.go | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 002447a60a3..2f17ef97905 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -14,9 +14,7 @@ import (
 )
 
 // MaximumBids is the maximum number of bids that can be returned by this adapter.
-const (
-	MaxBids = 1
-)
+const maxBids = 1
 
 type adapter struct {
 	endpoint    *template.Template
@@ -193,7 +191,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest
 		return nil, []error{err}
 	}
 
-	bidResponse := adapters.NewBidderResponseWithBidsCapacity(MaxBids)
+	bidResponse := adapters.NewBidderResponseWithBidsCapacity(maxBids)
 	jsonData := bidResp["bids"].([]interface{})
 
 	for _, bidData := range jsonData {

From eceef873f613656008d6cdc78f66a1bac2b07dde Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Tue, 9 Jul 2024 22:38:23 +0100
Subject: [PATCH 43/75] Fix PR New Adapter: ResetDigital #3766

---
 adapters/resetdigital/resetdigital.go | 36 ++++++++++++++-------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 2f17ef97905..3e6e5db67a0 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -121,13 +121,16 @@ func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *ad
 	for i := range requestData.Imp {
 		imp := requestData.Imp[i]
 		bidType, err := getBidType(imp)
-
 		if err != nil {
 			errors = append(errors, err)
 			continue
 		}
 
-		splittedRequestData := processDataFromRequest(requestData, imp, bidType)
+		splittedRequestData, err := processDataFromRequest(requestData, imp, bidType)
+		if err != nil {
+			errors = append(errors, err)
+			continue
+		}
 
 		requestBody, err := json.Marshal(splittedRequestData)
 		if err != nil {
@@ -146,18 +149,19 @@ func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *ad
 	return requests, errors
 }
 
-func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp, bidType openrtb_ext.BidType) resetDigitalRequest {
-
+func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp, bidType openrtb_ext.BidType) (resetDigitalRequest, error) {
 	var resetDigitalRequestData resetDigitalRequest
-	resetDigitalRequestData.Site.Domain = requestData.Site.Domain
-	resetDigitalRequestData.Site.Referrer = requestData.Site.Page
+
+	// Check if requestData.Site is not nil before accessing its fields
+	if requestData.Site != nil {
+		resetDigitalRequestData.Site.Domain = requestData.Site.Domain
+		resetDigitalRequestData.Site.Referrer = requestData.Site.Page
+	}
 
 	resetDigitalRequestData.Imps = append(resetDigitalRequestData.Imps, resetDigitalRequestImps{})
 	resetDigitalRequestData.Imps[0].BidID = requestData.ID
 	resetDigitalRequestData.Imps[0].ImpID = imp.ID
 
-	var err error
-
 	if bidType == openrtb_ext.BidTypeBanner {
 		resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes = append(resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes, []int64{imp.Banner.Format[0].W, imp.Banner.Format[0].H})
 	}
@@ -166,19 +170,17 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 	}
 
 	var extData = make(map[string]interface{})
-	err = json.Unmarshal(imp.Ext, &extData)
+	err := json.Unmarshal(imp.Ext, &extData)
 	if err != nil {
+		return resetDigitalRequestData, err
+	}
 
-	} else {
-
-		resetDigitalRequestData.Imps[0].ZoneID.PlacementID = extData["bidder"].(map[string]interface{})["placement_id"].(string)
-		if resetDigitalRequestData.Imps[0].ZoneID.PlacementID == "test" {
-			resetDigitalRequestData.Imps[0].ForceBid = true
-		}
-
+	resetDigitalRequestData.Imps[0].ZoneID.PlacementID = extData["bidder"].(map[string]interface{})["placement_id"].(string)
+	if resetDigitalRequestData.Imps[0].ZoneID.PlacementID == "test" {
+		resetDigitalRequestData.Imps[0].ForceBid = true
 	}
-	return resetDigitalRequestData
 
+	return resetDigitalRequestData, nil
 }
 
 func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) {

From e86d017dab9208c248ad50caf79f4baac073680a Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Tue, 9 Jul 2024 22:41:31 +0100
Subject: [PATCH 44/75] Fix New Adapter: ResetDigital #3766

---
 adapters/resetdigital/resetdigital.go | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 3e6e5db67a0..fed91b47f05 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -111,13 +111,6 @@ func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *ad
 		errors   []error
 	)
 
-	referer := getReferer(requestData)
-	currency := getCurrency(requestData)
-
-	if referer == currency {
-		return nil, nil
-	}
-
 	for i := range requestData.Imp {
 		imp := requestData.Imp[i]
 		bidType, err := getBidType(imp)

From baa974f514e5d582b862b95fff79ae12f8db8ed3 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Tue, 16 Jul 2024 17:10:17 +0100
Subject: [PATCH 45/75] Fix multiple comments

---
 adapters/resetdigital/resetdigital.go | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index fed91b47f05..6d43678eff7 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -151,9 +151,10 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 		resetDigitalRequestData.Site.Referrer = requestData.Site.Page
 	}
 
-	resetDigitalRequestData.Imps = append(resetDigitalRequestData.Imps, resetDigitalRequestImps{})
-	resetDigitalRequestData.Imps[0].BidID = requestData.ID
-	resetDigitalRequestData.Imps[0].ImpID = imp.ID
+	resetDigitalRequestData.Imps = append(resetDigitalRequestData.Imps, resetDigitalRequestImps{
+		BidID: requestData.ID,
+		ImpID: imp.ID,
+	})
 
 	if bidType == openrtb_ext.BidTypeBanner {
 		resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes = append(resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes, []int64{imp.Banner.Format[0].W, imp.Banner.Format[0].H})
@@ -165,7 +166,7 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 	var extData = make(map[string]interface{})
 	err := json.Unmarshal(imp.Ext, &extData)
 	if err != nil {
-		return resetDigitalRequestData, err
+		return resetDigitalRequest{}, err
 	}
 
 	resetDigitalRequestData.Imps[0].ZoneID.PlacementID = extData["bidder"].(map[string]interface{})["placement_id"].(string)

From 73c3fe037b3d5acaca86b205438e01e10d984451 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Thu, 18 Jul 2024 18:07:32 +0100
Subject: [PATCH 46/75] New tests

---
 .../examplary/test-missing-cur.json           |  86 +++++++++++++
 .../examplary/test-missing-site.json          |  64 ++++++++++
 .../examplary/test-multi-format.json          | 119 ++++++++++++++++++
 .../examplary/test-request-error.json         |  74 +++++++++++
 4 files changed, 343 insertions(+)
 create mode 100644 adapters/resetdigital/resetdigitaltest/examplary/test-missing-cur.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/examplary/test-missing-site.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/examplary/test-multi-format.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/examplary/test-request-error.json

diff --git a/adapters/resetdigital/resetdigitaltest/examplary/test-missing-cur.json b/adapters/resetdigital/resetdigitaltest/examplary/test-missing-cur.json
new file mode 100644
index 00000000000..5b997219cc6
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/examplary/test-missing-cur.json
@@ -0,0 +1,86 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [
+      {
+        "id": "001",
+        "banner": {
+          "w": 300,
+          "h": 250
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "test"
+          }
+        }
+      }
+    ],
+    "site": {
+      "domain": "https://test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "cur": [],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [
+    {
+      "language": "en-US",
+      "site": {
+        "domain": "https://test.com",
+        "referrer": "https://test.com/2016/06/12"
+      },
+      "imps": [
+        {
+          "force_bid": 1,
+          "zone_id": {
+            "placementId": "test"
+          },
+          "bid_id": "01",
+          "imp_id": "001",
+          "ext": {
+            "gpid": "test"
+          },
+          "sizes": [
+            [
+              300,
+              250
+            ]
+          ],
+          "media_types": {
+            "banner": {
+              "sizes": [
+                [
+                  300,
+                  250
+                ]
+              ]
+            }
+          }
+        }
+      ]
+    }
+  ],
+  "expectedBidResponses": [
+    {
+      "bids": [
+        {
+          "bid_id": "01",
+          "imp_id": "001",
+          "cpm": 1.0,
+          "cid": "1002088",
+          "crid": "1000763-1002088",
+          "adid": "1002088",
+          "w": "300",
+          "h": "250",
+          "seat": "resetdigital",
+          "html": "<script  />"
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/test-missing-site.json b/adapters/resetdigital/resetdigitaltest/examplary/test-missing-site.json
new file mode 100644
index 00000000000..84660ad96b8
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/examplary/test-missing-site.json
@@ -0,0 +1,64 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [
+      {
+        "id": "001",
+        "banner": {
+          "w": 300,
+          "h": 250
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "test"
+          }
+        }
+      }
+    ],
+    "cur": [
+      "USD"
+    ],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [
+    {
+      "language": "en-US",
+      "site": {},
+      "imps": [
+        {
+          "force_bid": 1,
+          "zone_id": {
+            "placementId": "test"
+          },
+          "bid_id": "01",
+          "imp_id": "001",
+          "ext": {
+            "gpid": "test"
+          },
+          "sizes": [
+            [
+              300,
+              250
+            ]
+          ],
+          "media_types": {
+            "banner": {
+              "sizes": [
+                [
+                  300,
+                  250
+                ]
+              ]
+            }
+          }
+        }
+      ]
+    }
+  ],
+  "expectedBidResponses": []
+}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/test-multi-format.json b/adapters/resetdigital/resetdigitaltest/examplary/test-multi-format.json
new file mode 100644
index 00000000000..c0278301bc0
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/examplary/test-multi-format.json
@@ -0,0 +1,119 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [
+      {
+        "id": "001",
+        "banner": {
+          "w": 300,
+          "h": 250
+        },
+        "video": {
+          "mimes": [
+            "video/mp4"
+          ],
+          "minduration": 5,
+          "maxduration": 60,
+          "protocols": [
+            2,
+            3
+          ],
+          "w": 640,
+          "h": 480
+        },
+        "audio": {
+          "mimes": [
+            "audio/mp3"
+          ],
+          "minduration": 5,
+          "maxduration": 60
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "test"
+          }
+        }
+      }
+    ],
+    "site": {
+      "domain": "https://test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "cur": [
+      "USD"
+    ],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [
+    {
+      "language": "en-US",
+      "site": {
+        "domain": "https://test.com",
+        "referrer": "https://test.com/2016/06/12"
+      },
+      "imps": [
+        {
+          "force_bid": 1,
+          "zone_id": {
+            "placementId": "test"
+          },
+          "bid_id": "01",
+          "imp_id": "001",
+          "ext": {
+            "gpid": "test"
+          },
+          "sizes": [
+            [
+              300,
+              250
+            ]
+          ],
+          "media_types": {
+            "banner": {
+              "sizes": [
+                [
+                  300,
+                  250
+                ]
+              ]
+            },
+            "video": {
+              "sizes": [
+                [
+                  640,
+                  480
+                ]
+              ]
+            },
+            "audio": {
+              "sizes": []
+            }
+          }
+        }
+      ]
+    }
+  ],
+  "expectedBidResponses": [
+    {
+      "bids": [
+        {
+          "bid_id": "01",
+          "imp_id": "001",
+          "cpm": 1.0,
+          "cid": "1002088",
+          "crid": "1000763-1002088",
+          "adid": "1002088",
+          "w": "300",
+          "h": "250",
+          "seat": "resetdigital",
+          "html": "<script  />"
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/test-request-error.json b/adapters/resetdigital/resetdigitaltest/examplary/test-request-error.json
new file mode 100644
index 00000000000..11c17e8e36d
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/examplary/test-request-error.json
@@ -0,0 +1,74 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [
+      {
+        "id": "001",
+        "banner": {
+          "w": 300,
+          "h": 250
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "test"
+          }
+        }
+      }
+    ],
+    "site": {
+      "domain": "https://test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "cur": [
+      "USD"
+    ],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [
+    {
+      "language": "en-US",
+      "site": {
+        "domain": "https://test.com",
+        "referrer": "https://test.com/2016/06/12"
+      },
+      "imps": [
+        {
+          "force_bid": 1,
+          "zone_id": {
+            "placementId": "test"
+          },
+          "bid_id": "01",
+          "imp_id": "001",
+          "ext": {
+            "gpid": "test"
+          },
+          "sizes": [
+            [
+              300,
+              250
+            ]
+          ],
+          "media_types": {
+            "banner": {
+              "sizes": [
+                [
+                  300,
+                  250
+                ]
+              ]
+            }
+          }
+        }
+      ]
+    }
+  ],
+  "expectedBidResponses": [],
+  "errors": [
+    "Error in request processing"
+  ]
+}
\ No newline at end of file

From 246010fd1acdc4efbe70a7e925c1843b3b2e0760 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Thu, 25 Jul 2024 00:19:54 +0100
Subject: [PATCH 47/75] Fix http.StatusBadRequest and non http.StatusOK codes
 should not be excluded. Can be rewritten as below:

---
 adapters/resetdigital/resetdigital.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 6d43678eff7..6842ba2a0a2 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -178,10 +178,14 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 }
 
 func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) {
-	if response.StatusCode == http.StatusNoContent || response.StatusCode == http.StatusBadRequest || response.StatusCode != http.StatusOK {
+	if adapters.IsResponseStatusCodeNoContent(response) {
 		return nil, nil
 	}
 
+	if err := adapters.CheckResponseStatusCodeForErrors(response); err != nil {
+		return nil, []error{err}
+	}
+
 	var bidResp map[string]interface{}
 	if err := json.Unmarshal(response.Body, &bidResp); err != nil {
 		return nil, []error{err}

From cff58179d7ecdfae8345e38d95a341ff61ad2b90 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Fri, 16 Aug 2024 15:57:25 +0100
Subject: [PATCH 48/75] Not running tests at this momment

---
 adapters/resetdigital/resetdigital.go         |  42 ++++---
 adapters/resetdigital/resetdigital_test.go    |  15 +++
 .../examplary/simple-banner.json              |  88 --------------
 .../exemplary/simple-banner.json              | 109 ++++++++++++++++++
 4 files changed, 152 insertions(+), 102 deletions(-)
 delete mode 100644 adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 6842ba2a0a2..5d44ac092d2 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -89,14 +89,6 @@ func addNonEmptyHeaders(headers *http.Header, headerValues map[string]string) {
 	}
 }
 
-func getReferer(request *openrtb2.BidRequest) string {
-	if request.Site == nil {
-		return ""
-	}
-
-	return request.Site.Domain
-}
-
 func getCurrency(request *openrtb2.BidRequest) string {
 	if len(request.Cur) == 0 {
 		return "USD"
@@ -113,6 +105,7 @@ func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *ad
 
 	for i := range requestData.Imp {
 		imp := requestData.Imp[i]
+
 		bidType, err := getBidType(imp)
 		if err != nil {
 			errors = append(errors, err)
@@ -136,8 +129,10 @@ func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *ad
 			Uri:     a.endpointUri,
 			Body:    requestBody,
 			Headers: getHeaders(requestData),
+			ImpIDs:  []string{imp.ID},
 		})
 	}
+	//clear requests.body
 
 	return requests, errors
 }
@@ -149,6 +144,7 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 	if requestData.Site != nil {
 		resetDigitalRequestData.Site.Domain = requestData.Site.Domain
 		resetDigitalRequestData.Site.Referrer = requestData.Site.Page
+
 	}
 
 	resetDigitalRequestData.Imps = append(resetDigitalRequestData.Imps, resetDigitalRequestImps{
@@ -157,12 +153,33 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 	})
 
 	if bidType == openrtb_ext.BidTypeBanner {
-		resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes = append(resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes, []int64{imp.Banner.Format[0].W, imp.Banner.Format[0].H})
+		if imp.Banner != nil {
+			var tempH int64 = *imp.Banner.H
+			var tempW int64 = *imp.Banner.W
+
+			if tempH > 0 && tempW > 0 {
+				resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes = append(
+					resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes,
+					[]int64{tempH, tempW},
+				)
+			}
+
+		}
 	}
+
 	if bidType == openrtb_ext.BidTypeVideo {
-		resetDigitalRequestData.Imps[0].MediaTypes.Video.Sizes = append(resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes, []int64{*imp.Video.W, *imp.Video.H})
+		if imp.Video != nil {
+			var tempH int64 = *imp.Video.H
+			var tempW int64 = *imp.Video.W
+
+			if tempH > 0 && tempW > 0 {
+				resetDigitalRequestData.Imps[0].MediaTypes.Video.Sizes = append(
+					resetDigitalRequestData.Imps[0].MediaTypes.Video.Sizes,
+					[]int64{tempH, tempW},
+				)
+			}
+		}
 	}
-
 	var extData = make(map[string]interface{})
 	err := json.Unmarshal(imp.Ext, &extData)
 	if err != nil {
@@ -170,9 +187,6 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 	}
 
 	resetDigitalRequestData.Imps[0].ZoneID.PlacementID = extData["bidder"].(map[string]interface{})["placement_id"].(string)
-	if resetDigitalRequestData.Imps[0].ZoneID.PlacementID == "test" {
-		resetDigitalRequestData.Imps[0].ForceBid = true
-	}
 
 	return resetDigitalRequestData, nil
 }
diff --git a/adapters/resetdigital/resetdigital_test.go b/adapters/resetdigital/resetdigital_test.go
index 0e31466503a..12f2dc09e17 100644
--- a/adapters/resetdigital/resetdigital_test.go
+++ b/adapters/resetdigital/resetdigital_test.go
@@ -7,9 +7,24 @@ import (
 
 	"github.com/prebid/openrtb/v20/openrtb2"
 	"github.com/prebid/prebid-server/v2/adapters"
+	"github.com/prebid/prebid-server/v2/adapters/adapterstest"
+	"github.com/prebid/prebid-server/v2/config"
+	"github.com/prebid/prebid-server/v2/openrtb_ext"
 	"github.com/stretchr/testify/assert"
 )
 
+func TestJsonSamples(t *testing.T) {
+
+	bidder, buildErr := Builder(openrtb_ext.BidderResetDigital, config.Adapter{
+		Endpoint: "https://test.com"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})
+
+	if buildErr != nil {
+		t.Fatalf("Builder returned unexpected error %v", buildErr)
+	}
+
+	adapterstest.RunJSONBidderTest(t, "resetdigitaltest", bidder)
+}
+
 func TestMakeRequests(t *testing.T) {
 	bidder := new(adapter)
 
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json b/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
deleted file mode 100644
index 20e768c675d..00000000000
--- a/adapters/resetdigital/resetdigitaltest/examplary/simple-banner.json
+++ /dev/null
@@ -1,88 +0,0 @@
-{
-  "mockBidRequest": {
-    "id": "12345",
-    "imp": [
-      {
-        "id": "001",
-        "banner": {
-          "w": 300,
-          "h": 250
-        },
-        "ext": {
-          "bidder": {
-            "placement_id": "test"
-          }
-        }
-      }
-    ],
-    "site": {
-      "domain": "https://test.com",
-      "page": "https://test.com/2016/06/12"
-    },
-    "cur": [
-      "USD"
-    ],
-    "device": {
-      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
-      "ip": "127.0.0.1",
-      "language": "EN"
-    },
-    "tmax": 500
-  },
-  "httpCalls": [
-    {
-      "language": "en-US",
-      "site": {
-        "domain": "https://test.com",
-        "referrer": "https://test.com/2016/06/12"
-      },
-      "imps": [
-        {
-          "force_bid" : 1,
-          "zone_id": {
-            "placementId": "test"
-          },
-          "bid_id": "01",
-          "imp_id": "001",
-          "ext": {
-            "gpid": "test"
-          },
-          "sizes": [
-            [
-              300,
-              250
-            ]
-          ],
-          "media_types": {
-            "banner": {
-              "sizes": [
-                [
-                  300,
-                  250
-                ]
-              ]
-            }
-          }
-        }
-      ]
-    }
-  ],
-  "expectedBidResponses": [
-    {
-      "bids": [
-          {
-              "bid_id": "01",
-              "imp_id": "001",
-              "cpm": 1.00,
-              "cid": "1002088",
-              "crid": "1000763-1002088",
-              "adid": "1002088",
-              "w": "300",
-              "h": "250",
-              "seat": "resetdigital",
-              "html": "<script  />"
-          }
-      ]
-  }
-  ]
-}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
new file mode 100644
index 00000000000..8d4e0adb1d0
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
@@ -0,0 +1,109 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [
+      {
+        "id": "001",
+        "banner": {
+          "w": 300,
+          "h": 250
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "test"
+          }
+        }
+      }
+    ],
+    "site": {
+      "domain": "test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "cur": [
+      "USD"
+    ],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [
+    {
+      "expectedRequest": {
+        "method": "POST",
+        "body": {
+          "id": "12345",
+          "imp": [
+            {
+              "id": "001",
+              "banner": {
+                "w": 300,
+                "h": 250
+              },
+              "ext": {
+                "bidder": {
+                  "placement_id": "test"
+                }
+              }
+            }
+          ],
+          "site": {
+            "domain": "test.com",
+            "page": "https://test.com/2016/06/12"
+          },
+          "cur": [
+            "USD"
+          ],
+          "device": {
+            "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+            "ip": "127.0.0.1",
+            "language": "EN"
+          },
+          "tmax": 500
+        },
+        "impIDs": [
+          "001"
+        ]
+      },
+      "mockResponse": {
+        "status": 200,
+        "body": {
+          "bids": [
+            {
+              "bid_id": "01",
+              "imp_id": "001",
+              "cpm": 1.00,
+              "cid": "1002088",
+              "crid": "1000763-1002088",
+              "adid": "1002088",
+              "w": "300",
+              "h": "250",
+              "seat": "resetdigital",
+              "html": "<script></script>"
+            }
+          ]
+        }
+      }
+    }
+  ],
+  "expectedBidResponses": [
+    {
+      "bids": [
+        {
+          "bid_id": "01",
+          "imp_id": "001",
+          "cpm": 1.00,
+          "cid": "1002088",
+          "crid": "1000763-1002088",
+          "adid": "1002088",
+          "w": "300",
+          "h": "250",
+          "seat": "resetdigital",
+          "html": "<script></script>"
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file

From 5ab55177427088ffd8ef420e24398d9e37c5f94a Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Thu, 29 Aug 2024 15:52:32 +0100
Subject: [PATCH 49/75] Update with help of Xandr Team

---
 adapters/resetdigital/resetdigital.go         | 244 +++++++++---------
 .../exemplary/simple-banner.json              | 150 ++++++-----
 openrtb_ext/imp_resetdigital.go               |   5 +-
 3 files changed, 198 insertions(+), 201 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 5d44ac092d2..bca84364e8c 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -22,34 +22,49 @@ type adapter struct {
 }
 
 type resetDigitalRequest struct {
-	Site resetDigitalRequestSite   `json:"site"`
-	Imps []resetDigitalRequestImps `json:"imps"`
+	Site resetDigitalSite  `json:"site"`
+	Imps []resetDigitalImp `json:"imps"`
 }
-
-type resetDigitalRequestSite struct {
+type resetDigitalSite struct {
 	Domain   string `json:"domain"`
 	Referrer string `json:"referrer"`
 }
+type resetDigitalImp struct {
+	ForceBid   bool                   `json:"force_bid"`
+	ZoneID     resetDigitalImpZone    `json:"zone_id"`
+	BidID      string                 `json:"bid_id"`
+	ImpID      string                 `json:"imp_id"`
+	Ext        resetDigitalImpExt     `json:"ext"`
+	MediaTypes resetDigitalMediaTypes `json:"media_types"`
+}
+type resetDigitalImpZone struct {
+	PlacementID string `json:"placementId"`
+}
+type resetDigitalImpExt struct {
+	Gpid string `json:"gpid"`
+}
+type resetDigitalMediaTypes struct {
+	Banner resetDigitalMediaType `json:"banner"`
+	Video  resetDigitalMediaType `json:"video"`
+}
+type resetDigitalMediaType struct {
+	Sizes [][]int64 `json:"sizes"`
+}
 
-type resetDigitalRequestImps struct {
-	ForceBid bool `json:"force_bid"`
-	ZoneID   struct {
-		PlacementID string `json:"placementId"`
-	} `json:"zone_id"`
-	BidID string `json:"bid_id"`
-	ImpID string `json:"imp_id"`
-	Ext   struct {
-		Gpid string `json:"gpid"`
-	} `json:"ext"`
-	Sizes      [][]int64 `json:"sizes"`
-	MediaTypes struct {
-		Banner struct {
-			Sizes [][]int64 `json:"sizes"`
-		} `json:"banner"`
-		Video struct {
-			Sizes [][]int64 `json:"sizes"`
-		} `json:"video"`
-	} `json:"media_types"`
+type resetDigitalBidResponse struct {
+	Bids []resetDigitalBid `json:"bids"`
+}
+type resetDigitalBid struct {
+	BidID string  `json:"bid_id"`
+	ImpID string  `json:"imp_id"`
+	CPM   float64 `json:"cpm"`
+	CID   string  `json:"cid,omitempty"`
+	CrID  string  `json:"crid,omitempty"`
+	AdID  string  `json:"adid"`
+	W     string  `json:"w,omitempty"`
+	H     string  `json:"h,omitempty"`
+	Seat  string  `json:"seat"`
+	HTML  string  `json:"html"`
 }
 
 func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) {
@@ -57,17 +72,16 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co
 	if err != nil {
 		return nil, fmt.Errorf("unable to parse endpoint url template: %v", err)
 	}
-
 	bidder := &adapter{
 		endpoint: template,
 	}
-
 	return bidder, nil
 }
+
 func getHeaders(request *openrtb2.BidRequest) http.Header {
 	headers := http.Header{}
 
-	if request.Device != nil && request.Site != nil {
+	if request != nil && request.Device != nil && request.Site != nil {
 		addNonEmptyHeaders(&headers, map[string]string{
 			"Referer":         request.Site.Page,
 			"Accept-Language": request.Device.Language,
@@ -78,9 +92,9 @@ func getHeaders(request *openrtb2.BidRequest) http.Header {
 			"Accept":          "application/json",
 		})
 	}
-
 	return headers
 }
+
 func addNonEmptyHeaders(headers *http.Header, headerValues map[string]string) {
 	for key, value := range headerValues {
 		if len(value) > 0 {
@@ -89,23 +103,13 @@ func addNonEmptyHeaders(headers *http.Header, headerValues map[string]string) {
 	}
 }
 
-func getCurrency(request *openrtb2.BidRequest) string {
-	if len(request.Cur) == 0 {
-		return "USD"
-	}
-
-	return request.Cur[0]
-}
-
 func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {
 	var (
 		requests []*adapters.RequestData
 		errors   []error
 	)
 
-	for i := range requestData.Imp {
-		imp := requestData.Imp[i]
-
+	for _, imp := range requestData.Imp {
 		bidType, err := getBidType(imp)
 		if err != nil {
 			errors = append(errors, err)
@@ -132,145 +136,133 @@ func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *ad
 			ImpIDs:  []string{imp.ID},
 		})
 	}
-	//clear requests.body
 
 	return requests, errors
 }
 
 func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp, bidType openrtb_ext.BidType) (resetDigitalRequest, error) {
-	var resetDigitalRequestData resetDigitalRequest
+	var reqData resetDigitalRequest
 
-	// Check if requestData.Site is not nil before accessing its fields
 	if requestData.Site != nil {
-		resetDigitalRequestData.Site.Domain = requestData.Site.Domain
-		resetDigitalRequestData.Site.Referrer = requestData.Site.Page
-
+		reqData.Site.Domain = requestData.Site.Domain
+		reqData.Site.Referrer = requestData.Site.Page
 	}
 
-	resetDigitalRequestData.Imps = append(resetDigitalRequestData.Imps, resetDigitalRequestImps{
+	reqData.Imps = append(reqData.Imps, resetDigitalImp{
 		BidID: requestData.ID,
 		ImpID: imp.ID,
 	})
 
-	if bidType == openrtb_ext.BidTypeBanner {
-		if imp.Banner != nil {
-			var tempH int64 = *imp.Banner.H
-			var tempW int64 = *imp.Banner.W
-
-			if tempH > 0 && tempW > 0 {
-				resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes = append(
-					resetDigitalRequestData.Imps[0].MediaTypes.Banner.Sizes,
-					[]int64{tempH, tempW},
-				)
-			}
+	if bidType == openrtb_ext.BidTypeBanner && imp.Banner != nil {
+		tempH := *imp.Banner.H
+		tempW := *imp.Banner.W
 
+		if tempH > 0 && tempW > 0 {
+			reqData.Imps[0].MediaTypes.Banner.Sizes = append(
+				reqData.Imps[0].MediaTypes.Banner.Sizes,
+				[]int64{tempH, tempW},
+			)
 		}
 	}
-
-	if bidType == openrtb_ext.BidTypeVideo {
-		if imp.Video != nil {
-			var tempH int64 = *imp.Video.H
-			var tempW int64 = *imp.Video.W
-
-			if tempH > 0 && tempW > 0 {
-				resetDigitalRequestData.Imps[0].MediaTypes.Video.Sizes = append(
-					resetDigitalRequestData.Imps[0].MediaTypes.Video.Sizes,
-					[]int64{tempH, tempW},
-				)
-			}
+	if bidType == openrtb_ext.BidTypeVideo && imp.Video != nil {
+		tempH := *imp.Video.H
+		tempW := *imp.Video.W
+
+		if tempH > 0 && tempW > 0 {
+			reqData.Imps[0].MediaTypes.Video.Sizes = append(
+				reqData.Imps[0].MediaTypes.Video.Sizes,
+				[]int64{tempH, tempW},
+			)
 		}
 	}
-	var extData = make(map[string]interface{})
-	err := json.Unmarshal(imp.Ext, &extData)
-	if err != nil {
+
+	var bidderExt adapters.ExtImpBidder
+	var resetDigitalExt openrtb_ext.ImpExtResetDigital
+
+	if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil {
 		return resetDigitalRequest{}, err
 	}
+	if err := json.Unmarshal(bidderExt.Bidder, &resetDigitalExt); err != nil {
+		return resetDigitalRequest{}, err
+	}
+	reqData.Imps[0].ZoneID.PlacementID = resetDigitalExt.PlacementID
 
-	resetDigitalRequestData.Imps[0].ZoneID.PlacementID = extData["bidder"].(map[string]interface{})["placement_id"].(string)
-
-	return resetDigitalRequestData, nil
+	return reqData, nil
 }
 
-func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) {
-	if adapters.IsResponseStatusCodeNoContent(response) {
+func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) {
+	if adapters.IsResponseStatusCodeNoContent(responseData) {
 		return nil, nil
 	}
 
-	if err := adapters.CheckResponseStatusCodeForErrors(response); err != nil {
+	if err := adapters.CheckResponseStatusCodeForErrors(responseData); err != nil {
 		return nil, []error{err}
 	}
 
-	var bidResp map[string]interface{}
-	if err := json.Unmarshal(response.Body, &bidResp); err != nil {
+	var response resetDigitalBidResponse
+	if err := json.Unmarshal(responseData.Body, &response); err != nil {
 		return nil, []error{err}
 	}
 
-	bidResponse := adapters.NewBidderResponseWithBidsCapacity(maxBids)
-	jsonData := bidResp["bids"].([]interface{})
+	bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp))
+
+	requestImps := make(map[string]openrtb2.Imp)
+	for _, imp := range request.Imp {
+		requestImps[imp.ID] = imp
+	}
 
-	for _, bidData := range jsonData {
-		bidMap := bidData.(map[string]interface{})
-		bid := getBidFromResponse(bidMap)
+	for i := range response.Bids {
+		resetDigitalBid := &response.Bids[i]
+
+		bid := getBidFromResponse(resetDigitalBid)
 		if bid == nil {
 			continue
 		}
 
-		bidTypes, err := getBidTypes(internalRequest.Imp[0])
+		bidType, err := GetMediaTypeForImp(requestImps, bid.ImpID)
 		if err != nil {
 			return nil, []error{err}
 		}
 
-		for _, bidType := range bidTypes {
-			bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{
-				Bid:     bid,
-				BidType: bidType,
-			})
+		b := &adapters.TypedBid{
+			Bid:     bid,
+			BidType: bidType,
+			Seat:    openrtb_ext.BidderName(resetDigitalBid.Seat),
 		}
+		bidResponse.Bids = append(bidResponse.Bids, b)
+	}
+
+	if len(request.Cur) == 0 {
+		bidResponse.Currency = "USD"
 	}
 
-	bidResponse.Currency = getCurrency(internalRequest)
 	return bidResponse, nil
 }
-func getBidFromResponse(requestData map[string]interface{}) *openrtb2.Bid {
-	processData := requestData["bid_id"].(string)
-
-	bid := &openrtb2.Bid{
-		ID:    processData,
-		Price: getBidPrice(requestData),
-		ImpID: requestData["imp_id"].(string),
-		CrID:  requestData["crid"].(string),
-	}
 
-	if value, ok := requestData["html"].(string); ok {
-		bid.AdM = value
+func getBidFromResponse(bidResponse *resetDigitalBid) *openrtb2.Bid {
+	if bidResponse.CPM == 0 {
+		return nil
 	}
 
-	if value, ok := requestData["w"].(string); ok {
-		if i, err := strconv.ParseInt(value, 10, 64); err == nil && i > 0 {
-			bid.W = i
-		}
+	bid := &openrtb2.Bid{
+		ID:    bidResponse.BidID,
+		Price: bidResponse.CPM,
+		ImpID: bidResponse.ImpID,
+		CID:   bidResponse.CID,
+		CrID:  bidResponse.CrID,
+		AdM:   bidResponse.HTML,
 	}
 
-	if value, ok := requestData["h"].(string); ok {
-		if i, err := strconv.ParseInt(value, 10, 64); err == nil && i > 0 {
-			bid.H = i
-		}
+	if i, err := strconv.ParseInt(bidResponse.W, 10, 64); err == nil && i > 0 {
+		bid.W = i
 	}
-
-	if bid.Price == 0 {
-		return nil
+	if i, err := strconv.ParseInt(bidResponse.H, 10, 64); err == nil && i > 0 {
+		bid.H = i
 	}
 
 	return bid
 }
 
-func getBidPrice(requestData map[string]interface{}) float64 {
-	if value, ok := requestData["cpm"].(float64); ok {
-		return value
-	}
-	return 0.0 // Default value if "cpm" doesn't exist or is not a float64
-}
-
 func getBidType(imp openrtb2.Imp) (openrtb_ext.BidType, error) {
 	if imp.Banner != nil {
 		return openrtb_ext.BidTypeBanner, nil
@@ -301,3 +293,15 @@ func getBidTypes(imp openrtb2.Imp) ([]openrtb_ext.BidType, error) {
 
 	return bidTypes, nil
 }
+
+func GetMediaTypeForImp(reqImps map[string]openrtb2.Imp, bidImpID string) (openrtb_ext.BidType, error) {
+	mediaType := openrtb_ext.BidTypeBanner
+
+	if reqImp, ok := reqImps[bidImpID]; ok {
+		if reqImp.Banner == nil && reqImp.Video != nil {
+			mediaType = openrtb_ext.BidTypeVideo
+		}
+		return mediaType, nil
+	}
+	return "", fmt.Errorf("unknown media type for bid imp ID %s", bidImpID)
+}
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
index 8d4e0adb1d0..f526cc86290 100644
--- a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
@@ -1,22 +1,20 @@
 {
   "mockBidRequest": {
     "id": "12345",
-    "imp": [
-      {
-        "id": "001",
-        "banner": {
-          "w": 300,
-          "h": 250
-        },
-        "ext": {
-          "bidder": {
-            "placement_id": "test"
-          }
+    "imp": [{
+      "id": "001",
+      "banner": {
+        "h": 300,
+        "w": 250
+      },
+      "ext": {
+        "bidder": {
+          "placement_id": "placement-id-1"
         }
       }
-    ],
+    }],
     "site": {
-      "domain": "test.com",
+      "domain": "https://test.com",
       "page": "https://test.com/2016/06/12"
     },
     "cur": [
@@ -29,69 +27,47 @@
     },
     "tmax": 500
   },
-  "httpCalls": [
-    {
-      "expectedRequest": {
-        "method": "POST",
-        "body": {
-          "id": "12345",
-          "imp": [
-            {
-              "id": "001",
-              "banner": {
-                "w": 300,
-                "h": 250
-              },
-              "ext": {
-                "bidder": {
-                  "placement_id": "test"
-                }
-              }
-            }
-          ],
-          "site": {
-            "domain": "test.com",
-            "page": "https://test.com/2016/06/12"
-          },
-          "cur": [
-            "USD"
-          ],
-          "device": {
-            "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
-            "ip": "127.0.0.1",
-            "language": "EN"
+  "httpCalls": [{
+    "expectedRequest": {
+      "method": "POST",
+      "body": {
+        "imps": [{
+          "bid_id": "12345",
+          "ext": {
+            "gpid": ""
           },
-          "tmax": 500
-        },
-        "impIDs": [
-          "001"
-        ]
-      },
-      "mockResponse": {
-        "status": 200,
-        "body": {
-          "bids": [
-            {
-              "bid_id": "01",
-              "imp_id": "001",
-              "cpm": 1.00,
-              "cid": "1002088",
-              "crid": "1000763-1002088",
-              "adid": "1002088",
-              "w": "300",
-              "h": "250",
-              "seat": "resetdigital",
-              "html": "<script></script>"
+          "force_bid": false,
+          "imp_id": "001",
+          "media_types": {
+            "banner": {
+              "sizes": [
+                [
+                  300,
+                  250
+                ]
+              ]
+            },
+            "video": {
+              "sizes": null
             }
-          ]
+          },
+          "zone_id": {
+            "placementId": "placement-id-1"
+          }
+        }],
+        "site": {
+          "domain": "https://test.com",
+          "referrer": "https://test.com/2016/06/12"
         }
-      }
-    }
-  ],
-  "expectedBidResponses": [
-    {
-      "bids": [
-        {
+      },
+      "impIDs": [
+        "001"
+      ]
+    },
+    "mockResponse": {
+      "status": 200,
+      "body": {
+        "bids": [{
           "bid_id": "01",
           "imp_id": "001",
           "cpm": 1.00,
@@ -101,9 +77,27 @@
           "w": "300",
           "h": "250",
           "seat": "resetdigital",
-          "html": "<script></script>"
-        }
-      ]
+          "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
+        }]
+      }
     }
-  ]
-}
\ No newline at end of file
+  }],
+
+  "expectedBidResponses": [{
+    "currency": "USD",
+    "bids": [{
+      "bid": {
+        "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
+        "cid": "1002088",
+        "crid": "1000763-1002088",
+        "id": "01",
+        "impid": "001",
+        "price": 1.00,
+        "w": 300,
+        "h": 250
+      },
+      "type": "banner",
+      "seat": "resetdigital"
+    }]
+  }]
+}
diff --git a/openrtb_ext/imp_resetdigital.go b/openrtb_ext/imp_resetdigital.go
index b9e2ac8297b..6e3f800ab98 100644
--- a/openrtb_ext/imp_resetdigital.go
+++ b/openrtb_ext/imp_resetdigital.go
@@ -1,6 +1,5 @@
 package openrtb_ext
 
-type ExtResetDigital struct {
-	BidID string `json:"bid_id"`
-	ImpID string `json:"imp_id"`
+type ImpExtResetDigital struct {
+	PlacementID string `json:"placement_id"`
 }

From d3df8f2244c69023ce48ee2ef07976891699f846 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Thu, 29 Aug 2024 16:09:40 +0100
Subject: [PATCH 50/75] Simplify Tests

---
 adapters/resetdigital/resetdigital_test.go | 86 ----------------------
 1 file changed, 86 deletions(-)

diff --git a/adapters/resetdigital/resetdigital_test.go b/adapters/resetdigital/resetdigital_test.go
index 12f2dc09e17..d160e9a23fe 100644
--- a/adapters/resetdigital/resetdigital_test.go
+++ b/adapters/resetdigital/resetdigital_test.go
@@ -1,16 +1,11 @@
 package resetdigital
 
 import (
-	"encoding/json"
-	"net/http"
 	"testing"
 
-	"github.com/prebid/openrtb/v20/openrtb2"
-	"github.com/prebid/prebid-server/v2/adapters"
 	"github.com/prebid/prebid-server/v2/adapters/adapterstest"
 	"github.com/prebid/prebid-server/v2/config"
 	"github.com/prebid/prebid-server/v2/openrtb_ext"
-	"github.com/stretchr/testify/assert"
 )
 
 func TestJsonSamples(t *testing.T) {
@@ -24,84 +19,3 @@ func TestJsonSamples(t *testing.T) {
 
 	adapterstest.RunJSONBidderTest(t, "resetdigitaltest", bidder)
 }
-
-func TestMakeRequests(t *testing.T) {
-	bidder := new(adapter)
-
-	request := &openrtb2.BidRequest{
-		ID: "12345",
-
-		Imp: []openrtb2.Imp{{
-			ID: "001",
-			Banner: &openrtb2.Banner{
-				Format: []openrtb2.Format{
-					{W: 300, H: 250},
-				},
-			},
-
-			Ext: json.RawMessage(`{"bidder": {"placement_id": "test"}}`), //Placement_id test is used to get the force bid true
-		}},
-		Site: &openrtb2.Site{
-			Domain: "https://test.com",
-			Page:   "https://test.com/2016/06/12",
-		},
-		Cur: []string{"USD"},
-		Device: &openrtb2.Device{
-			UA:       "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
-			IP:       "127.0.0.1",
-			Language: "EN",
-		},
-	}
-
-	reqs, errs := bidder.MakeRequests(request, &adapters.ExtraRequestInfo{})
-
-	assert.Empty(t, errs, "Got unexpected errors while building HTTP requests: %v", errs)
-	assert.Equal(t, 1, len(reqs), "Unexpected number of HTTP requests. Got %d. Expected %d", len(reqs), 1)
-}
-
-func TestMakeBids(t *testing.T) {
-	request := &openrtb2.BidRequest{
-		ID: "12345",
-
-		Imp: []openrtb2.Imp{{
-			ID: "001",
-			Banner: &openrtb2.Banner{
-				Format: []openrtb2.Format{
-					{W: 300, H: 250},
-				},
-			},
-
-			Ext: json.RawMessage(`{"bidder": {"placement_id": "test"}}`), //Placement_id test is used to get the force bid true
-		}},
-		Site: &openrtb2.Site{
-			Domain: "https://test.com",
-			Page:   "https://test.com/2016/06/12",
-		},
-		Cur: []string{"USD"},
-		Device: &openrtb2.Device{
-			UA:       "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
-			IP:       "127.0.0.1",
-			Language: "EN",
-		},
-	}
-
-	requestJson, _ := json.Marshal(request)
-	reqData := &adapters.RequestData{
-		Method: "POST",
-		Uri:    "test-uri",
-		Body:   requestJson,
-	}
-
-	httpResp := &adapters.ResponseData{
-		StatusCode: http.StatusOK,
-		Body:       []byte(`{"bids":[{"bid_id":"01","imp_id":"001","cpm":10.00,"cid":"1002088","crid":"1000763-1002088","adid":"1002088","w":"300","h":"250","seat":"resetdigital","html":"<scriptsrc=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-15&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\"type=\"text/javascript\"></script><imagesrc='https://adsreq.resetdigital.co?brid=0000000000000001'/><imagesrc='https://sync2.resetdigital.co/hbsync?ck=0000000000000001'/>"}]}`),
-	}
-
-	bidder := new(adapter)
-	bidResponse, errs := bidder.MakeBids(request, reqData, httpResp)
-
-	assert.Empty(t, errs, "Expected 0 errors. Got %d", len(errs))
-
-	assert.Equal(t, float64(10), bidResponse.Bids[0].Bid.Price,
-		"Expected Price 10. Got: %s", bidResponse.Bids[0].Bid.Price)
-}

From c1795b8bbd6aedc7bbd2321bd1a5bf1fce8df8d0 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Tue, 10 Sep 2024 11:18:03 +0100
Subject: [PATCH 51/75] PR of functioning version

---
 adapters/resetdigital/resetdigital.go         | 72 +++++++++----------
 .../exemplary/simple-banner.json              |  5 +-
 static/bidder-info/resetdigital.yaml          | 35 +++++----
 static/bidder-params/resetdigital.json        | 12 +++-
 4 files changed, 60 insertions(+), 64 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index bca84364e8c..70b73c5ac6d 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -13,9 +13,6 @@ import (
 	"github.com/prebid/prebid-server/v2/openrtb_ext"
 )
 
-// MaximumBids is the maximum number of bids that can be returned by this adapter.
-const maxBids = 1
-
 type adapter struct {
 	endpoint    *template.Template
 	endpointUri string
@@ -30,7 +27,6 @@ type resetDigitalSite struct {
 	Referrer string `json:"referrer"`
 }
 type resetDigitalImp struct {
-	ForceBid   bool                   `json:"force_bid"`
 	ZoneID     resetDigitalImpZone    `json:"zone_id"`
 	BidID      string                 `json:"bid_id"`
 	ImpID      string                 `json:"imp_id"`
@@ -81,7 +77,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co
 func getHeaders(request *openrtb2.BidRequest) http.Header {
 	headers := http.Header{}
 
-	if request != nil && request.Device != nil && request.Site != nil {
+	if request != nil && request.Device != nil && request.Site != nil { // what about request.App? Do we need to do something different with Referrer in the app case assuming we care about app?
 		addNonEmptyHeaders(&headers, map[string]string{
 			"Referer":         request.Site.Page,
 			"Accept-Language": request.Device.Language,
@@ -154,24 +150,32 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 	})
 
 	if bidType == openrtb_ext.BidTypeBanner && imp.Banner != nil {
-		tempH := *imp.Banner.H
-		tempW := *imp.Banner.W
-
+		var tempH, tempW int64
+		if imp.Banner.H != nil {
+			tempH = *imp.Banner.H
+		}
+		if imp.Banner.W != nil {
+			tempW = *imp.Banner.W
+		}
 		if tempH > 0 && tempW > 0 {
 			reqData.Imps[0].MediaTypes.Banner.Sizes = append(
 				reqData.Imps[0].MediaTypes.Banner.Sizes,
-				[]int64{tempH, tempW},
+				[]int64{tempW, tempH},
 			)
 		}
 	}
 	if bidType == openrtb_ext.BidTypeVideo && imp.Video != nil {
-		tempH := *imp.Video.H
-		tempW := *imp.Video.W
-
+		var tempH, tempW int64
+		if imp.Video.H != nil {
+			tempH = *imp.Video.H
+		}
+		if imp.Video.W != nil {
+			tempW = *imp.Video.W
+		}
 		if tempH > 0 && tempW > 0 {
 			reqData.Imps[0].MediaTypes.Video.Sizes = append(
 				reqData.Imps[0].MediaTypes.Video.Sizes,
-				[]int64{tempH, tempW},
+				[]int64{tempW, tempH},
 			)
 		}
 	}
@@ -206,6 +210,7 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R
 
 	bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp))
 
+	var errs []error
 	requestImps := make(map[string]openrtb2.Imp)
 	for _, imp := range request.Imp {
 		requestImps[imp.ID] = imp
@@ -214,8 +219,10 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R
 	for i := range response.Bids {
 		resetDigitalBid := &response.Bids[i]
 
-		bid := getBidFromResponse(resetDigitalBid)
+		bid, err := getBidFromResponse(resetDigitalBid)
+		// handle the error
 		if bid == nil {
+			// it would be better to return an error here
 			continue
 		}
 
@@ -236,12 +243,13 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R
 		bidResponse.Currency = "USD"
 	}
 
-	return bidResponse, nil
+	return bidResponse, errs
 }
 
-func getBidFromResponse(bidResponse *resetDigitalBid) *openrtb2.Bid {
+func getBidFromResponse(bidResponse *resetDigitalBid) (*openrtb2.Bid, error) {
 	if bidResponse.CPM == 0 {
-		return nil
+		// brian to check how to report this
+		return nil, nil
 	}
 
 	bid := &openrtb2.Bid{
@@ -255,12 +263,17 @@ func getBidFromResponse(bidResponse *resetDigitalBid) *openrtb2.Bid {
 
 	if i, err := strconv.ParseInt(bidResponse.W, 10, 64); err == nil && i > 0 {
 		bid.W = i
-	}
+	} else if err != nil {
+		return nil, err
+	} // the error should be returned here if ParseInt fails
+
 	if i, err := strconv.ParseInt(bidResponse.H, 10, 64); err == nil && i > 0 {
 		bid.H = i
-	}
+	} else if err != nil {
+		return nil, err
+	} // the error should be returned here if ParseInt fails
 
-	return bid
+	return bid, nil
 }
 
 func getBidType(imp openrtb2.Imp) (openrtb_ext.BidType, error) {
@@ -275,25 +288,6 @@ func getBidType(imp openrtb2.Imp) (openrtb_ext.BidType, error) {
 	return "", fmt.Errorf("failed to find matching imp for bid %s", imp.ID)
 }
 
-func getBidTypes(imp openrtb2.Imp) ([]openrtb_ext.BidType, error) {
-	var bidTypes []openrtb_ext.BidType
-
-	if imp.Banner != nil {
-		bidTypes = append(bidTypes, openrtb_ext.BidTypeBanner)
-	}
-	if imp.Video != nil {
-		bidTypes = append(bidTypes, openrtb_ext.BidTypeVideo)
-	}
-	if imp.Audio != nil {
-		bidTypes = append(bidTypes, openrtb_ext.BidTypeAudio)
-	}
-	if len(bidTypes) == 0 {
-		return nil, fmt.Errorf("failed to find matching imp for bid %s", imp.ID)
-	}
-
-	return bidTypes, nil
-}
-
 func GetMediaTypeForImp(reqImps map[string]openrtb2.Imp, bidImpID string) (openrtb_ext.BidType, error) {
 	mediaType := openrtb_ext.BidTypeBanner
 
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
index f526cc86290..bf22010c6fd 100644
--- a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
@@ -36,14 +36,13 @@
           "ext": {
             "gpid": ""
           },
-          "force_bid": false,
           "imp_id": "001",
           "media_types": {
             "banner": {
               "sizes": [
                 [
-                  300,
-                  250
+                  250,
+                  300
                 ]
               ]
             },
diff --git a/static/bidder-info/resetdigital.yaml b/static/bidder-info/resetdigital.yaml
index 99c22378318..3c4a206389a 100644
--- a/static/bidder-info/resetdigital.yaml
+++ b/static/bidder-info/resetdigital.yaml
@@ -1,19 +1,16 @@
-    endpoint: http://b-us-east14.resetdigital.co:9001
-    meta-info:
-      maintainer-email: biddersupport@resetdigital.co
-      app-media-types:
-        - banner
-        - video
-        - audio
-      site-media-types:
-        - banner
-        - video
-        - audio
-      supported-vendors:
-      vendor-id: 1162
-    usersync:
-      cookie-family-name: resetdigital
-      redirect:
-        url: https://sync.resetdigital.co/csync?pid=rubicon&redir={{redirect_url}}
-        support-cors: false
-        uid-macro: '$USER_ID'
+endpoint: http://b-us-east14.resetdigital.co:9001
+maintainer:
+  email: biddersupport@resetdigital.co
+capabilities:
+  site:
+    mediaTypes:
+    - banner
+    - video
+    - audio
+gvlVendorID: 1162
+userSync:
+  key: resetdigital
+  supportCors: false
+  redirect:
+    url: https://sync.resetdigital.co/csync?pid=rubicon&redir={{redirect_url}}
+    userMacro: '$USER_ID'
diff --git a/static/bidder-params/resetdigital.json b/static/bidder-params/resetdigital.json
index d2bcfb6bb5f..4d0538893f7 100644
--- a/static/bidder-params/resetdigital.json
+++ b/static/bidder-params/resetdigital.json
@@ -1,7 +1,13 @@
 {
     "$schema": "http://json-schema.org/draft-04/schema#",
-    "title": "Relevant Digital Adapter Params",
-    "description": "A schema which validates params accepted by the Relevant Digital adapter",
+    "title": "Reset Digital Adapter Params",
+    "description": "A schema which validates params accepted by the Reset Digital adapter",
     "type": "object",
-    "properties": {}
+    "properties": {
+        "placement_id": {
+            "type": "string",
+            "minLength": 1,
+            "description": "Placement ID for the Reset Digital ad unit. This is the identifier for the ad unit on the Reset Digital platform, and its optional"
+        }
+    }
 }

From 1665bc9a1b533e3bbe7ec084d09fd475b1b8f839 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Sun, 29 Sep 2024 20:07:47 +0100
Subject: [PATCH 52/75] Added Video and removed unwanted data

---
 .../examplary/test-missing-cur.json           |  86 -------------
 .../examplary/test-missing-site.json          |  64 ----------
 .../examplary/test-multi-format.json          | 119 ------------------
 .../examplary/test-request-error.json         |  74 -----------
 .../exemplary/simple-video.json               | 106 ++++++++++++++++
 5 files changed, 106 insertions(+), 343 deletions(-)
 delete mode 100644 adapters/resetdigital/resetdigitaltest/examplary/test-missing-cur.json
 delete mode 100644 adapters/resetdigital/resetdigitaltest/examplary/test-missing-site.json
 delete mode 100644 adapters/resetdigital/resetdigitaltest/examplary/test-multi-format.json
 delete mode 100644 adapters/resetdigital/resetdigitaltest/examplary/test-request-error.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json

diff --git a/adapters/resetdigital/resetdigitaltest/examplary/test-missing-cur.json b/adapters/resetdigital/resetdigitaltest/examplary/test-missing-cur.json
deleted file mode 100644
index 5b997219cc6..00000000000
--- a/adapters/resetdigital/resetdigitaltest/examplary/test-missing-cur.json
+++ /dev/null
@@ -1,86 +0,0 @@
-{
-  "mockBidRequest": {
-    "id": "12345",
-    "imp": [
-      {
-        "id": "001",
-        "banner": {
-          "w": 300,
-          "h": 250
-        },
-        "ext": {
-          "bidder": {
-            "placement_id": "test"
-          }
-        }
-      }
-    ],
-    "site": {
-      "domain": "https://test.com",
-      "page": "https://test.com/2016/06/12"
-    },
-    "cur": [],
-    "device": {
-      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
-      "ip": "127.0.0.1",
-      "language": "EN"
-    },
-    "tmax": 500
-  },
-  "httpCalls": [
-    {
-      "language": "en-US",
-      "site": {
-        "domain": "https://test.com",
-        "referrer": "https://test.com/2016/06/12"
-      },
-      "imps": [
-        {
-          "force_bid": 1,
-          "zone_id": {
-            "placementId": "test"
-          },
-          "bid_id": "01",
-          "imp_id": "001",
-          "ext": {
-            "gpid": "test"
-          },
-          "sizes": [
-            [
-              300,
-              250
-            ]
-          ],
-          "media_types": {
-            "banner": {
-              "sizes": [
-                [
-                  300,
-                  250
-                ]
-              ]
-            }
-          }
-        }
-      ]
-    }
-  ],
-  "expectedBidResponses": [
-    {
-      "bids": [
-        {
-          "bid_id": "01",
-          "imp_id": "001",
-          "cpm": 1.0,
-          "cid": "1002088",
-          "crid": "1000763-1002088",
-          "adid": "1002088",
-          "w": "300",
-          "h": "250",
-          "seat": "resetdigital",
-          "html": "<script  />"
-        }
-      ]
-    }
-  ]
-}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/test-missing-site.json b/adapters/resetdigital/resetdigitaltest/examplary/test-missing-site.json
deleted file mode 100644
index 84660ad96b8..00000000000
--- a/adapters/resetdigital/resetdigitaltest/examplary/test-missing-site.json
+++ /dev/null
@@ -1,64 +0,0 @@
-{
-  "mockBidRequest": {
-    "id": "12345",
-    "imp": [
-      {
-        "id": "001",
-        "banner": {
-          "w": 300,
-          "h": 250
-        },
-        "ext": {
-          "bidder": {
-            "placement_id": "test"
-          }
-        }
-      }
-    ],
-    "cur": [
-      "USD"
-    ],
-    "device": {
-      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
-      "ip": "127.0.0.1",
-      "language": "EN"
-    },
-    "tmax": 500
-  },
-  "httpCalls": [
-    {
-      "language": "en-US",
-      "site": {},
-      "imps": [
-        {
-          "force_bid": 1,
-          "zone_id": {
-            "placementId": "test"
-          },
-          "bid_id": "01",
-          "imp_id": "001",
-          "ext": {
-            "gpid": "test"
-          },
-          "sizes": [
-            [
-              300,
-              250
-            ]
-          ],
-          "media_types": {
-            "banner": {
-              "sizes": [
-                [
-                  300,
-                  250
-                ]
-              ]
-            }
-          }
-        }
-      ]
-    }
-  ],
-  "expectedBidResponses": []
-}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/test-multi-format.json b/adapters/resetdigital/resetdigitaltest/examplary/test-multi-format.json
deleted file mode 100644
index c0278301bc0..00000000000
--- a/adapters/resetdigital/resetdigitaltest/examplary/test-multi-format.json
+++ /dev/null
@@ -1,119 +0,0 @@
-{
-  "mockBidRequest": {
-    "id": "12345",
-    "imp": [
-      {
-        "id": "001",
-        "banner": {
-          "w": 300,
-          "h": 250
-        },
-        "video": {
-          "mimes": [
-            "video/mp4"
-          ],
-          "minduration": 5,
-          "maxduration": 60,
-          "protocols": [
-            2,
-            3
-          ],
-          "w": 640,
-          "h": 480
-        },
-        "audio": {
-          "mimes": [
-            "audio/mp3"
-          ],
-          "minduration": 5,
-          "maxduration": 60
-        },
-        "ext": {
-          "bidder": {
-            "placement_id": "test"
-          }
-        }
-      }
-    ],
-    "site": {
-      "domain": "https://test.com",
-      "page": "https://test.com/2016/06/12"
-    },
-    "cur": [
-      "USD"
-    ],
-    "device": {
-      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
-      "ip": "127.0.0.1",
-      "language": "EN"
-    },
-    "tmax": 500
-  },
-  "httpCalls": [
-    {
-      "language": "en-US",
-      "site": {
-        "domain": "https://test.com",
-        "referrer": "https://test.com/2016/06/12"
-      },
-      "imps": [
-        {
-          "force_bid": 1,
-          "zone_id": {
-            "placementId": "test"
-          },
-          "bid_id": "01",
-          "imp_id": "001",
-          "ext": {
-            "gpid": "test"
-          },
-          "sizes": [
-            [
-              300,
-              250
-            ]
-          ],
-          "media_types": {
-            "banner": {
-              "sizes": [
-                [
-                  300,
-                  250
-                ]
-              ]
-            },
-            "video": {
-              "sizes": [
-                [
-                  640,
-                  480
-                ]
-              ]
-            },
-            "audio": {
-              "sizes": []
-            }
-          }
-        }
-      ]
-    }
-  ],
-  "expectedBidResponses": [
-    {
-      "bids": [
-        {
-          "bid_id": "01",
-          "imp_id": "001",
-          "cpm": 1.0,
-          "cid": "1002088",
-          "crid": "1000763-1002088",
-          "adid": "1002088",
-          "w": "300",
-          "h": "250",
-          "seat": "resetdigital",
-          "html": "<script  />"
-        }
-      ]
-    }
-  ]
-}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/examplary/test-request-error.json b/adapters/resetdigital/resetdigitaltest/examplary/test-request-error.json
deleted file mode 100644
index 11c17e8e36d..00000000000
--- a/adapters/resetdigital/resetdigitaltest/examplary/test-request-error.json
+++ /dev/null
@@ -1,74 +0,0 @@
-{
-  "mockBidRequest": {
-    "id": "12345",
-    "imp": [
-      {
-        "id": "001",
-        "banner": {
-          "w": 300,
-          "h": 250
-        },
-        "ext": {
-          "bidder": {
-            "placement_id": "test"
-          }
-        }
-      }
-    ],
-    "site": {
-      "domain": "https://test.com",
-      "page": "https://test.com/2016/06/12"
-    },
-    "cur": [
-      "USD"
-    ],
-    "device": {
-      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
-      "ip": "127.0.0.1",
-      "language": "EN"
-    },
-    "tmax": 500
-  },
-  "httpCalls": [
-    {
-      "language": "en-US",
-      "site": {
-        "domain": "https://test.com",
-        "referrer": "https://test.com/2016/06/12"
-      },
-      "imps": [
-        {
-          "force_bid": 1,
-          "zone_id": {
-            "placementId": "test"
-          },
-          "bid_id": "01",
-          "imp_id": "001",
-          "ext": {
-            "gpid": "test"
-          },
-          "sizes": [
-            [
-              300,
-              250
-            ]
-          ],
-          "media_types": {
-            "banner": {
-              "sizes": [
-                [
-                  300,
-                  250
-                ]
-              ]
-            }
-          }
-        }
-      ]
-    }
-  ],
-  "expectedBidResponses": [],
-  "errors": [
-    "Error in request processing"
-  ]
-}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json
new file mode 100644
index 00000000000..260217be957
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json
@@ -0,0 +1,106 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [{
+      "id": "001",
+      "video": {
+          "w": 900,
+          "h": 250,
+          "mimes": [
+            "video/x-flv",
+            "video/mp4"
+          ]
+        },
+      "ext": {
+        "bidder": {
+          "placement_id": "placement-id-1"
+        }
+      }
+    }],
+    "site": {
+      "domain": "https://test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "cur": [
+      "USD"
+    ],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [{
+    "expectedRequest": {
+      "method": "POST",
+      "body": {
+        "imps": [{
+          "bid_id": "12345",
+          "ext": {
+            "gpid": ""
+          },
+          "imp_id": "001",
+          "media_types": {
+            "banner": {
+             "sizes": null
+            },
+            "video": {
+              "sizes": [
+                [
+                  900,
+                  250
+                ]
+              ]
+            }
+          },
+          "zone_id": {
+            "placementId": "placement-id-1"
+          }
+        }],
+        "site": {
+          "domain": "https://test.com",
+          "referrer": "https://test.com/2016/06/12"
+        }
+      },
+      "impIDs": [
+        "001"
+      ]
+    },
+    "mockResponse": {
+      "status": 200,
+      "body": {
+        "bids": [{
+          "bid_id": "01",
+          "imp_id": "001",
+          "cpm": 1.00,
+          "cid": "1002088",
+          "crid": "1000763-1002088",
+          "adid": "1002088",
+          "w": "900",
+          "h": "250",
+          "seat": "resetdigital",
+          "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
+        }]
+      }
+    }
+  }],
+
+  "expectedBidResponses": [{
+    "currency": "USD",
+    "bids": [{
+      "bid": {
+        "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
+        "cid": "1002088",
+        "crid": "1000763-1002088",
+        "id": "01",
+        "impid": "001",
+        "price": 1.00,
+        "w": 900,
+        "h": 250
+      },
+      "type": "video",
+      "seat": "resetdigital"
+    }]
+  }]
+}

From 0f6f5b1ef64d59dab640980f514c5e4a5016c214 Mon Sep 17 00:00:00 2001
From: Emmanuel <eogbonna097@gmail.com>
Date: Fri, 25 Oct 2024 12:12:54 +0100
Subject: [PATCH 53/75] created mock test

---
 adapters/resetdigital/resetdigital.go         |  23 ++--
 .../exemplary/invalid_video_dim.json          |  74 ++++++++++++
 .../supplemental/fake_test.json               |  69 +++++++++++
 .../supplemental/invalid-device.json          |  74 ++++++++++++
 .../supplemental/invalid_cur.json             |  76 ++++++++++++
 .../supplemental/invalid_media_def.json       |  35 ++++++
 .../supplemental/invalid_placement_id.json    |  43 +++++++
 .../supplemental/multi_format.json            | 108 ++++++++++++++++++
 .../supplemental/unknown_media.json           |  68 +++++++++++
 9 files changed, 559 insertions(+), 11 deletions(-)
 create mode 100644 adapters/resetdigital/resetdigitaltest/exemplary/invalid_video_dim.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/fake_test.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/invalid_media_def.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/invalid_placement_id.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 70b73c5ac6d..6ea7faf566f 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -223,12 +223,14 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R
 		// handle the error
 		if bid == nil {
 			// it would be better to return an error here
+			errs = append(errs, err)
 			continue
 		}
 
 		bidType, err := GetMediaTypeForImp(requestImps, bid.ImpID)
 		if err != nil {
-			return nil, []error{err}
+			errs = append(errs, err)
+			continue
 		}
 
 		b := &adapters.TypedBid{
@@ -261,18 +263,17 @@ func getBidFromResponse(bidResponse *resetDigitalBid) (*openrtb2.Bid, error) {
 		AdM:   bidResponse.HTML,
 	}
 
-	if i, err := strconv.ParseInt(bidResponse.W, 10, 64); err == nil && i > 0 {
-		bid.W = i
-	} else if err != nil {
+	w, err := strconv.ParseInt(bidResponse.W, 10, 64)
+	if err != nil {
 		return nil, err
-	} // the error should be returned here if ParseInt fails
+	}
+	bid.W = w
 
-	if i, err := strconv.ParseInt(bidResponse.H, 10, 64); err == nil && i > 0 {
-		bid.H = i
-	} else if err != nil {
+	h, err := strconv.ParseInt(bidResponse.H, 10, 64)
+	if err != nil {
 		return nil, err
-	} // the error should be returned here if ParseInt fails
-
+	}
+	bid.H = h
 	return bid, nil
 }
 
@@ -298,4 +299,4 @@ func GetMediaTypeForImp(reqImps map[string]openrtb2.Imp, bidImpID string) (openr
 		return mediaType, nil
 	}
 	return "", fmt.Errorf("unknown media type for bid imp ID %s", bidImpID)
-}
+}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/invalid_video_dim.json b/adapters/resetdigital/resetdigitaltest/exemplary/invalid_video_dim.json
new file mode 100644
index 00000000000..6cbc6cf2be8
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/invalid_video_dim.json
@@ -0,0 +1,74 @@
+{
+    "mockBidRequest": {
+      "id": "12345",
+      "imp": [{
+        "id": "001",
+        "video": {
+            "w": 0,
+            "h": 480,
+            "mimes": [
+              "video/x-flv",
+              "video/mp4"
+            ]
+          },
+          "ext": {
+            "bidder": {
+              "placement_id": "placement-id-1"
+            }
+          }
+      }],
+      "site": {
+        "domain": "https://test.com",
+        "page": "https://test.com/2016/06/12"
+      },
+      "cur": [
+        "USD"
+      ],
+      "device": {
+        "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+        "ip": "127.0.0.1",
+        "language": "EN"
+      },
+      "tmax": 500,
+      "debug": 1 
+    },
+    "httpCalls": [{
+      "expectedRequest": {
+        "method": "POST",
+        "body": {
+          "imps": [{
+            "bid_id": "12345",
+            "ext": {
+              "gpid": ""
+            },
+            "imp_id": "001",
+            "media_types": {
+              "banner": {
+               "sizes": null
+              },
+              "video": {
+                "sizes": null
+              }
+            },
+            "zone_id": {
+              "placementId": "placement-id-1"
+            }
+          }],
+          "site": {
+            "domain": "https://test.com",
+            "referrer": "https://test.com/2016/06/12"
+          }
+        },
+        "impIDs": [
+          "001"
+        ]
+      },
+      "mockResponse": {
+        "status": 204,
+        "body": {
+          "error": "Unexpected status code: 204. Run with request.debug = 1 for more info"
+        }
+      }
+    }],
+    "expectedBidResponses": []
+  }
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/fake_test.json b/adapters/resetdigital/resetdigitaltest/supplemental/fake_test.json
new file mode 100644
index 00000000000..7cb52868e6c
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/fake_test.json
@@ -0,0 +1,69 @@
+{
+    "mockBidRequest": {
+      "id": "test_nil_invalid_impid",
+      "imp": [
+        {
+          "id": null,  
+          "banner": {
+            "h": 250,
+            "w": 300
+          },
+          "ext": {
+            "bidder": {
+              "placement_id": "placement-id-7"
+            }
+          }
+        }
+      ],
+      "site": {
+        "domain": "https://example.com",
+        "page": "https://example.com/page"
+      },
+      "cur": ["USD"],
+      "device": {
+        "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
+        "ip": "192.168.0.1",
+        "language": "EN"
+      },
+      "tmax": 500
+    },
+    "httpCalls": [
+      {
+        "expectedRequest": {
+          "method": "POST",
+          "body": {
+            "imps": [
+              {
+                "bid_id": "test_nil_invalid_impid",
+                "imp_id": null, 
+                "media_types": {
+                  "banner": {
+                    "sizes": [[300, 250]]
+                  }
+                },
+                "zone_id": {
+                  "placementId": "placement-id-7"
+                }
+              }
+            ],
+            "site": {
+              "domain": "https://example.com",
+              "referrer": "https://example.com/page"
+            }
+          },
+          "impIDs": ["006", null, "unknown_imp_id"]
+        }
+      }
+    ],
+    "expectedMakeBidsErrors": [
+      {
+        "value": "bid is nil or imp ID is missing",
+        "comparison": "literal"
+      },
+      {
+        "value": "unknown media type for bid imp ID unknown_imp_id",
+        "comparison": "literal"
+      }
+    ]
+  }
+  
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json
new file mode 100644
index 00000000000..6865ffc355c
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json
@@ -0,0 +1,74 @@
+{
+    "mockBidRequest": {
+      "id": "test-invalid-device",
+      "imp": [{
+        "id": "001",
+        "banner": {
+          "h": 300,
+          "w": 250
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "placement-id-1"
+          }
+        }
+      }],
+      "site": {
+        "domain": "https://test.com",
+        "page": "https://test.com/2016/06/12"
+      },
+      "cur": [
+        "USD"
+      ]
+    },
+    "httpCalls": [{
+      "expectedRequest": {
+        "method": "POST",
+        "body": {
+          "imps": [{
+            "bid_id": "test-invalid-device",
+            "ext": {
+              "gpid": ""
+            },
+            "imp_id": "001",
+            "media_types": {
+              "banner": {
+                "sizes": [
+                  [
+                    250,
+                    300
+                  ]
+                ]
+              },
+              "video": {
+                "sizes": null
+              }
+            },
+            "zone_id": {
+              "placementId": "placement-id-1"
+            }
+          }],
+          "site": {
+            "domain": "https://test.com",
+            "referrer": "https://test.com/2016/06/12"
+          }
+        },
+        "impIDs": [
+          "001"
+        ]
+      },
+      "mockResponse": {
+        "status": 400,
+        "body": {
+          "error": "Unexpected status code: 400. Run with request.debug = 1 for more info"
+        }
+      }
+    }],
+    "expectedMakeBidsErrors": [
+        {
+          "value": "Unexpected status code: 400. Run with request.debug = 1 for more info",
+          "comparison": "literal"
+        }
+      ]
+  }
+  
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json
new file mode 100644
index 00000000000..d148516b1c2
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json
@@ -0,0 +1,76 @@
+{
+    "mockBidRequest": {
+      "id": "test-invalid-cur",
+      "imp": [{
+        "id": "001",
+        "banner": {
+          "h": 300,
+          "w": 250
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "placement-id-1"
+          }
+        }
+      }],
+      "site": {
+        "domain": "https://test.com",
+        "page": "https://test.com/2016/06/12"
+      },
+      "device": {
+        "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+        "ip": "127.0.0.1",
+        "language": "EN"
+      }
+    },
+    "httpCalls": [{
+        "expectedRequest": {
+          "method": "POST",
+          "body": {
+            "imps": [{
+              "bid_id": "test-invalid-cur",
+              "ext": {
+                "gpid": ""
+              },
+              "imp_id": "001",
+              "media_types": {
+                "banner": {
+                  "sizes": [
+                    [
+                      250,
+                      300
+                    ]
+                  ]
+                },
+                "video": {
+                  "sizes": null
+                }
+              },
+              "zone_id": {
+                "placementId": "placement-id-1"
+              }
+            }],
+            "site": {
+              "domain": "https://test.com",
+              "referrer": "https://test.com/2016/06/12"
+            }
+          },
+          "impIDs": [
+            "001"
+          ]
+        },
+        "mockResponse": {
+          "status": 400,
+          "body": {
+            "error": "Unexpected status code: 400. Run with request.debug = 1 for more info"
+          }
+        }
+      }],
+      "expectedMakeBidsErrors": [
+        {
+          "value": "Unexpected status code: 400. Run with request.debug = 1 for more info",
+          "comparison": "literal"
+        }
+      ]
+  }
+  
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid_media_def.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_media_def.json
new file mode 100644
index 00000000000..0c24e666b9f
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_media_def.json
@@ -0,0 +1,35 @@
+{
+    "mockBidRequest": {
+      "id": "12345",
+      "imp": [{
+        "id": "001",
+          "ext": {
+            "bidder": {
+              "placement_id": "placement-id-1"
+            }
+          }
+      }],
+      "site": {
+        "domain": "https://test.com",
+        "page": "https://test.com/2016/06/12"
+      },
+      "cur": [
+        "USD"
+      ],
+      "device": {
+        "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+        "ip": "127.0.0.1",
+        "language": "EN"
+      },
+      "tmax": 500,
+      "debug": 1 
+    },
+    "httpCalls": [],
+    "expectedMakeRequestsErrors": [
+      {
+        "value": "failed to find matching imp for bid 001",
+        "comparison": "literal"
+      }
+    ],
+    "expectedBidResponses": []
+  }
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid_placement_id.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_placement_id.json
new file mode 100644
index 00000000000..14959b36d14
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_placement_id.json
@@ -0,0 +1,43 @@
+{
+    "mockBidRequest": {
+      "id": "12345",
+      "imp": [{
+        "id": "001",
+        "video": {
+            "w": 900,
+            "h": 250,
+            "mimes": [
+              "video/x-flv",
+              "video/mp4"
+            ]
+          },
+        "ext": {
+          "bidder": {
+            "placement_id": 1
+          }
+        }
+      }],
+      "site": {
+        "domain": "https://test.com",
+        "page": "https://test.com/2016/06/12"
+      },
+      "cur": [
+        "USD"
+      ],
+      "device": {
+        "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+        "ip": "127.0.0.1",
+        "language": "EN"
+      },
+      "tmax": 500,
+      "debug": 1 
+    },
+    "httpCalls": [],
+    "expectedMakeRequestsErrors": [
+      {
+        "value": "json: cannot unmarshal number into Go struct field ImpExtResetDigital.placement_id of type string",
+        "comparison": "literal"
+      }
+    ],
+    "expectedBidResponses": []
+  }
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json b/adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json
new file mode 100644
index 00000000000..f17e0d149ab
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json
@@ -0,0 +1,108 @@
+{
+    "mockBidRequest": {
+      "id": "test-multi-format",
+      "imp": [{
+        "id": "001",
+        "banner": {
+          "w": 300,
+          "h": 600
+        },
+        "video": {
+          "w": 900,
+          "h": 250,
+          "mimes": ["video/mp4"]
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "placement-id-1"
+          }
+        }
+      }],
+      "site": {
+        "domain": "https://test.com",
+        "page": "https://test.com/2016/06/12"
+      },
+      "cur": [
+        "USD"
+      ],
+      "device": {
+        "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+        "ip": "127.0.0.1",
+        "language": "EN"
+      },
+      "tmax": 500
+    },
+    "httpCalls": [{
+      "expectedRequest": {
+        "method": "POST",
+        "body": {
+            "imps": [{
+              "bid_id": "test-multi-format",
+              "ext": {
+                "gpid": ""
+              },
+              "imp_id": "001",
+              "media_types": {
+                "banner": {
+                  "sizes": [
+                    [
+                      300,
+                      600
+                    ]
+                  ]
+                },
+                "video": {
+                  "sizes": null
+                }
+              },
+              "zone_id": {
+                "placementId": "placement-id-1"
+              }
+            }],
+            "site": {
+              "domain": "https://test.com",
+              "referrer": "https://test.com/2016/06/12"
+            }
+          },
+        "impIDs": [
+            "001"
+          ]
+      },
+      "mockResponse": {
+        "status": 200,
+        "body": {
+          "bids": [{
+            "bid_id": "01",
+            "imp_id": "001",
+            "cpm": 1.00,
+            "cid": "1002088",
+            "crid": "1000763-1002088",
+            "adid": "1002088",
+            "w": "300",
+            "h": "250",
+            "seat": "resetdigital",
+            "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
+          }]
+        }
+      }
+    }],
+  
+    "expectedBidResponses": [{
+      "currency": "USD",
+      "bids": [{
+        "bid": {
+          "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
+          "cid": "1002088",
+          "crid": "1000763-1002088",
+          "id": "01",
+          "impid": "001",
+          "price": 1.00,
+          "w": 300,
+          "h": 250
+        },
+        "type": "banner",
+        "seat": "resetdigital"
+      }]
+    }]
+  }
+  
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json b/adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json
new file mode 100644
index 00000000000..08cd3f22944
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json
@@ -0,0 +1,68 @@
+{
+    "mockBidRequest": {
+      "id": "test-unknown-media-type",
+      "imp": [{
+        "id": "001",
+        "audio": { 
+          "mimes": ["audio/mpeg"]
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "placement-id-1"
+          }
+        }
+      }],
+     "site": {
+        "domain": "https://test.com",
+        "page": "https://test.com/2016/06/12"
+      },
+      "cur": [
+        "USD"
+      ]
+    },
+    "httpCalls": [{
+      "expectedRequest": {
+        "method": "POST",
+        "body": {
+          "imps": [{
+            "bid_id": "test-unknown-media-type",
+            "ext": {
+              "gpid": ""
+            },
+            "imp_id": "001",
+            "media_types": {
+              "banner": {
+                "sizes": null
+              },
+              "video": {
+                  "sizes": null
+              }
+            },
+            "zone_id": {
+              "placementId": "placement-id-1"
+            }
+          }],
+          "site": {
+            "domain": "https://test.com",
+            "referrer": "https://test.com/2016/06/12"
+          }
+        },
+        "impIDs": [
+          "001"
+        ]
+      },
+      "mockResponse": {
+        "status": 400,
+        "body": {
+          "error": "unknown media type for bid imp ID 003"
+        }
+      }
+    }],
+    "expectedMakeBidsErrors": [
+      {
+        "value": "Unexpected status code: 400. Run with request.debug = 1 for more info",
+        "comparison": "literal"
+      }
+    ]
+  }
+  
\ No newline at end of file

From 27863dbd75d38d51a2fefda54a0b57104a7d1fc9 Mon Sep 17 00:00:00 2001
From: Emmanuel <eogbonna097@gmail.com>
Date: Thu, 31 Oct 2024 15:35:08 +0100
Subject: [PATCH 54/75] delete fake_test.json

---
 .../supplemental/fake_test.json               | 69 -------------------
 1 file changed, 69 deletions(-)
 delete mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/fake_test.json

diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/fake_test.json b/adapters/resetdigital/resetdigitaltest/supplemental/fake_test.json
deleted file mode 100644
index 7cb52868e6c..00000000000
--- a/adapters/resetdigital/resetdigitaltest/supplemental/fake_test.json
+++ /dev/null
@@ -1,69 +0,0 @@
-{
-    "mockBidRequest": {
-      "id": "test_nil_invalid_impid",
-      "imp": [
-        {
-          "id": null,  
-          "banner": {
-            "h": 250,
-            "w": 300
-          },
-          "ext": {
-            "bidder": {
-              "placement_id": "placement-id-7"
-            }
-          }
-        }
-      ],
-      "site": {
-        "domain": "https://example.com",
-        "page": "https://example.com/page"
-      },
-      "cur": ["USD"],
-      "device": {
-        "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
-        "ip": "192.168.0.1",
-        "language": "EN"
-      },
-      "tmax": 500
-    },
-    "httpCalls": [
-      {
-        "expectedRequest": {
-          "method": "POST",
-          "body": {
-            "imps": [
-              {
-                "bid_id": "test_nil_invalid_impid",
-                "imp_id": null, 
-                "media_types": {
-                  "banner": {
-                    "sizes": [[300, 250]]
-                  }
-                },
-                "zone_id": {
-                  "placementId": "placement-id-7"
-                }
-              }
-            ],
-            "site": {
-              "domain": "https://example.com",
-              "referrer": "https://example.com/page"
-            }
-          },
-          "impIDs": ["006", null, "unknown_imp_id"]
-        }
-      }
-    ],
-    "expectedMakeBidsErrors": [
-      {
-        "value": "bid is nil or imp ID is missing",
-        "comparison": "literal"
-      },
-      {
-        "value": "unknown media type for bid imp ID unknown_imp_id",
-        "comparison": "literal"
-      }
-    ]
-  }
-  
\ No newline at end of file

From f0da5d754ab2a9417f6f0ae30de5f4e6a471b756 Mon Sep 17 00:00:00 2001
From: Dirk Merkel <dirk@resetdigital.co>
Date: Sun, 3 Nov 2024 15:26:36 -0800
Subject: [PATCH 55/75] Adding support for audio media type and a corresponding
 simple-audio.json test case.

---
 -vv                                           |  78 ++++++++
 adapters/resetdigital/resetdigital.go         |  17 +-
 .../exemplary/simple-audio.json               | 183 ++++++++++++++++++
 .../exemplary/simple-banner.json              |   6 +
 .../exemplary/simple-video.json               | 170 +++++++++-------
 .../supplemental/invalid-device.json          |   6 +
 .../supplemental/invalid_cur.json             |   6 +
 .../invalid_video_dim.json                    |  11 +-
 .../supplemental/multi_format.json            |   6 +
 .../supplemental/unknown_media.json           |   8 +-
 10 files changed, 412 insertions(+), 79 deletions(-)
 create mode 100644 -vv
 create mode 100644 adapters/resetdigital/resetdigitaltest/exemplary/simple-audio.json
 rename adapters/resetdigital/resetdigitaltest/{exemplary => supplemental}/invalid_video_dim.json (86%)

diff --git a/-vv b/-vv
new file mode 100644
index 00000000000..28f4857db7b
--- /dev/null
+++ b/-vv
@@ -0,0 +1,78 @@
+mode: set
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:67.119,69.16 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:69.16,71.3 1 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:72.2,75.20 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:78.59,81.68 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:81.68,91.3 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:92.2,92.16 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:95.79,96.39 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:96.39,97.21 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:97.21,99.4 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:103.141,109.38 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:109.38,111.17 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:111.17,113.12 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:116.3,117.17 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:117.17,119.12 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:122.3,123.17 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:123.17,125.12 2 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:128.3,134.5 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:137.2,137.25 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:140.139,143.29 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:143.29,146.3 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:148.2,153.63 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:153.63,155.26 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:155.26,157.4 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:158.3,158.26 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:158.26,160.4 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:161.3,161.29 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:161.29,166.4 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:168.2,168.61 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:168.61,170.25 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:170.25,172.4 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:173.3,173.25 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:173.25,175.4 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:176.3,176.29 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:176.29,181.4 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:183.2,183.61 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:183.62,197.3 0 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:199.2,202.60 3 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:202.60,204.3 1 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:205.2,205.75 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:205.75,207.3 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:208.2,210.21 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:213.166,214.58 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:214.58,216.3 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:218.2,218.80 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:218.80,220.3 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:222.2,223.69 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:223.69,225.3 1 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:227.2,231.34 4 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:231.34,233.3 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:235.2,235.31 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:235.31,240.17 3 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:240.17,243.12 2 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:246.3,247.17 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:247.17,249.12 2 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:252.3,257.49 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:260.2,260.27 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:260.27,262.3 1 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:264.2,264.26 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:267.78,268.26 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:268.26,271.3 1 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:273.2,283.16 3 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:283.16,285.3 1 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:286.2,289.16 3 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:289.16,291.3 1 0
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:292.2,293.17 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:296.64,297.23 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:297.23,299.3 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:299.8,299.29 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:299.29,301.3 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:301.8,301.29 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:301.29,303.3 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:305.2,305.73 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:308.104,311.41 2 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:311.41,312.50 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:312.50,316.4 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:317.3,317.24 1 1
+github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:319.2,319.73 1 0
diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 6ea7faf566f..5f3f4b1b333 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -42,11 +42,12 @@ type resetDigitalImpExt struct {
 type resetDigitalMediaTypes struct {
 	Banner resetDigitalMediaType `json:"banner"`
 	Video  resetDigitalMediaType `json:"video"`
+	Audio  resetDigitalMediaType `json:"audio"`
 }
 type resetDigitalMediaType struct {
 	Sizes [][]int64 `json:"sizes"`
+	Mimes []string `json:"mimes"`
 }
-
 type resetDigitalBidResponse struct {
 	Bids []resetDigitalBid `json:"bids"`
 }
@@ -178,6 +179,16 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 				[]int64{tempW, tempH},
 			)
 		}
+		if imp.Video.MIMEs != nil{
+			reqData.Imps[0].MediaTypes.Video.Mimes = append(
+				imp.Video.MIMEs,
+			)
+		}
+	}
+	if bidType == openrtb_ext.BidTypeAudio && imp.Audio != nil && imp.Audio.MIMEs != nil{
+		reqData.Imps[0].MediaTypes.Audio.Mimes = append(
+			imp.Audio.MIMEs,
+		)
 	}
 
 	var bidderExt adapters.ExtImpBidder
@@ -295,8 +306,10 @@ func GetMediaTypeForImp(reqImps map[string]openrtb2.Imp, bidImpID string) (openr
 	if reqImp, ok := reqImps[bidImpID]; ok {
 		if reqImp.Banner == nil && reqImp.Video != nil {
 			mediaType = openrtb_ext.BidTypeVideo
+		} else if reqImp.Audio != nil {
+			mediaType = openrtb_ext.BidTypeAudio
 		}
 		return mediaType, nil
 	}
 	return "", fmt.Errorf("unknown media type for bid imp ID %s", bidImpID)
-}
\ No newline at end of file
+}
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-audio.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-audio.json
new file mode 100644
index 00000000000..80ae00517f6
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-audio.json
@@ -0,0 +1,183 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "at": 1,
+    "bcat": [
+      "IAB24",
+      "IAB25",
+      "IAB26"
+    ],
+    "cur": [
+      "USD"
+    ],
+    "source": {
+      "fd": 0,
+      "tid": "00000FBCE10DE8FA",
+      "schain": {
+        "complete": 1,
+        "ver": "1.0",
+        "nodes": [
+          {
+            "asi": "resetdigital.co",
+            "sid": "176",
+            "hp": 1
+          }
+        ]
+      }
+    },
+    "device": {
+      "ip": "35.146.176.97",
+      "js": 1,
+      "language": "en",
+      "ua": "PostmanRuntime/7.42.0"
+    },
+    "user": {
+      "id": "000011200BA1065C",
+      "buyeruid": "000011200BA1065C"
+    },
+    "app": {
+      "id": "test.com",
+      "bundle": "test.com",
+      "name": "test.com",
+      "content": {
+        "livestream": 1,
+        "genre": "F%C3%BAtbol",
+        "cat": [
+          ""
+        ],
+        "language": "es"
+      },
+      "publisher": {
+        "id": "176"
+      },
+      "keywords": ""
+    },
+    "imp": [
+      {
+        "id": "001",
+        "bidfloor": 1.429,
+        "tagid": "667",
+        "secure": 1,
+        "audio": {
+          "protocols": [
+            2,
+            3,
+            5,
+            6
+          ],
+          "mimes": [
+            "audio/mp4",
+            "audio/mp3"
+          ],
+          "api": [],
+          "minduration": 15,
+          "maxduration": 60,
+          "startdelay": -1
+        },
+        "ext": {
+          "bidder": {
+            "placement_id": "placement-id-1"
+          }
+        }
+      }
+    ],
+    "site": {
+      "domain": "https://test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "cur": [
+      "USD"
+    ],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 400
+  },
+  "httpCalls": [
+    {
+      "expectedRequest": {
+        "method": "POST",
+        "body": {
+          "imps": [
+            {
+              "bid_id": "12345",
+              "ext": {
+                "gpid": ""
+              },
+              "imp_id": "001",
+              "media_types": {
+                "banner": {
+                  "sizes": null,
+                  "mimes": null
+                },
+                "video": {
+                  "sizes": null,
+                  "mimes": null
+                },
+                "audio": {
+                  "sizes": null,
+                  "mimes": [
+                    "audio/mp4",
+                    "audio/mp3"
+                  ]
+                }
+              },
+              "zone_id": {
+                "placementId": "placement-id-1"
+              }
+            }
+          ],
+          "site": {
+            "domain": "https://test.com",
+            "referrer": "https://test.com/2016/06/12"
+          }
+        },
+        "impIDs": [
+          "001"
+        ]
+      },
+      "mockResponse": {
+        "status": 200,
+        "body": {
+          "bids": [
+            {
+              "bid_id": "01",
+              "imp_id": "001",
+              "cpm": 9.11,
+              "dealid": "RD-1000164",
+              "cid": "1000048-1002918",
+              "crid": "1003893",
+              "adid": "1003893",
+              "language": "en",
+              "w": "0",
+              "h": "0",
+              "seat": "resetdigital",
+              "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
+            }
+          ]
+        }
+      }
+    }
+  ],
+  "expectedBidResponses": [
+    {
+      "currency": "USD",
+      "bids": [
+        {
+          "bid": {
+            "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
+            "cid": "1000048-1002918",
+            "crid": "1003893",
+            "id": "01",
+            "impid": "001",
+            "price": 9.11
+          },
+          "type": "audio",
+          "seat": "resetdigital"
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
index bf22010c6fd..2e4a54c8a57 100644
--- a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
@@ -39,6 +39,7 @@
           "imp_id": "001",
           "media_types": {
             "banner": {
+              "mimes": null,
               "sizes": [
                 [
                   250,
@@ -47,6 +48,11 @@
               ]
             },
             "video": {
+              "mimes": null,
+              "sizes": null
+            },
+            "audio": {
+              "mimes": null,
               "sizes": null
             }
           },
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json
index 260217be957..0310ed18c46 100644
--- a/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json
@@ -1,9 +1,10 @@
 {
   "mockBidRequest": {
     "id": "12345",
-    "imp": [{
-      "id": "001",
-      "video": {
+    "imp": [
+      {
+        "id": "001",
+        "video": {
           "w": 900,
           "h": 250,
           "mimes": [
@@ -11,12 +12,13 @@
             "video/mp4"
           ]
         },
-      "ext": {
-        "bidder": {
-          "placement_id": "placement-id-1"
+        "ext": {
+          "bidder": {
+            "placement_id": "placement-id-1"
+          }
         }
       }
-    }],
+    ],
     "site": {
       "domain": "https://test.com",
       "page": "https://test.com/2016/06/12"
@@ -31,76 +33,94 @@
     },
     "tmax": 500
   },
-  "httpCalls": [{
-    "expectedRequest": {
-      "method": "POST",
-      "body": {
-        "imps": [{
-          "bid_id": "12345",
-          "ext": {
-            "gpid": ""
-          },
-          "imp_id": "001",
-          "media_types": {
-            "banner": {
-             "sizes": null
-            },
-            "video": {
-              "sizes": [
-                [
-                  900,
-                  250
-                ]
-              ]
+  "httpCalls": [
+    {
+      "expectedRequest": {
+        "method": "POST",
+        "body": {
+          "imps": [
+            {
+              "bid_id": "12345",
+              "ext": {
+                "gpid": ""
+              },
+              "imp_id": "001",
+              "media_types": {
+                "banner": {
+                  "mimes": null,
+                  "sizes": null
+                },
+                "video": {
+                  "sizes": [
+                    [
+                      900,
+                      250
+                    ]
+                  ],
+                  "mimes": [
+                    "video/x-flv",
+                    "video/mp4"
+                  ]
+                },
+                "audio": {
+                  "mimes": null,
+                  "sizes": null
+                }
+              },
+              "zone_id": {
+                "placementId": "placement-id-1"
+              }
             }
-          },
-          "zone_id": {
-            "placementId": "placement-id-1"
+          ],
+          "site": {
+            "domain": "https://test.com",
+            "referrer": "https://test.com/2016/06/12"
           }
-        }],
-        "site": {
-          "domain": "https://test.com",
-          "referrer": "https://test.com/2016/06/12"
-        }
+        },
+        "impIDs": [
+          "001"
+        ]
       },
-      "impIDs": [
-        "001"
-      ]
-    },
-    "mockResponse": {
-      "status": 200,
-      "body": {
-        "bids": [{
-          "bid_id": "01",
-          "imp_id": "001",
-          "cpm": 1.00,
-          "cid": "1002088",
-          "crid": "1000763-1002088",
-          "adid": "1002088",
-          "w": "900",
-          "h": "250",
-          "seat": "resetdigital",
-          "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
-        }]
+      "mockResponse": {
+        "status": 200,
+        "body": {
+          "bids": [
+            {
+              "bid_id": "01",
+              "imp_id": "001",
+              "cpm": 1.00,
+              "cid": "1002088",
+              "crid": "1000763-1002088",
+              "adid": "1002088",
+              "w": "900",
+              "h": "250",
+              "seat": "resetdigital",
+              "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
+            }
+          ]
+        }
       }
     }
-  }],
-
-  "expectedBidResponses": [{
-    "currency": "USD",
-    "bids": [{
-      "bid": {
-        "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
-        "cid": "1002088",
-        "crid": "1000763-1002088",
-        "id": "01",
-        "impid": "001",
-        "price": 1.00,
-        "w": 900,
-        "h": 250
-      },
-      "type": "video",
-      "seat": "resetdigital"
-    }]
-  }]
-}
+  ],
+  "expectedBidResponses": [
+    {
+      "currency": "USD",
+      "bids": [
+        {
+          "bid": {
+            "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
+            "cid": "1002088",
+            "crid": "1000763-1002088",
+            "id": "01",
+            "impid": "001",
+            "price": 1.00,
+            "w": 900,
+            "h": 250
+          },
+          "type": "video",
+          "seat": "resetdigital"
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json
index 6865ffc355c..fca85c84d4a 100644
--- a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json
@@ -33,6 +33,7 @@
             "imp_id": "001",
             "media_types": {
               "banner": {
+                "mimes": null,
                 "sizes": [
                   [
                     250,
@@ -41,6 +42,11 @@
                 ]
               },
               "video": {
+                "mimes": null,
+                "sizes": null
+              },
+              "audio": {
+                "mimes": null,
                 "sizes": null
               }
             },
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json
index d148516b1c2..878d9c07289 100644
--- a/adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json
@@ -35,6 +35,7 @@
               "imp_id": "001",
               "media_types": {
                 "banner": {
+                  "mimes": null,
                   "sizes": [
                     [
                       250,
@@ -43,6 +44,11 @@
                   ]
                 },
                 "video": {
+                  "mimes": null,
+                  "sizes": null
+                },
+                "audio": {
+                  "mimes": null,
                   "sizes": null
                 }
               },
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/invalid_video_dim.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_video_dim.json
similarity index 86%
rename from adapters/resetdigital/resetdigitaltest/exemplary/invalid_video_dim.json
rename to adapters/resetdigital/resetdigitaltest/supplemental/invalid_video_dim.json
index 6cbc6cf2be8..9a955ccb6a2 100644
--- a/adapters/resetdigital/resetdigitaltest/exemplary/invalid_video_dim.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid_video_dim.json
@@ -44,9 +44,18 @@
             "imp_id": "001",
             "media_types": {
               "banner": {
-               "sizes": null
+                "mimes": null,
+                "sizes": null
               },
               "video": {
+                "sizes": null,
+                "mimes": [
+                  "video/x-flv",
+                  "video/mp4"
+                ]
+              },
+              "audio": {
+                "mimes": null,
                 "sizes": null
               }
             },
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json b/adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json
index f17e0d149ab..66a441f6506 100644
--- a/adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json
@@ -44,6 +44,7 @@
               "imp_id": "001",
               "media_types": {
                 "banner": {
+                  "mimes": null,
                   "sizes": [
                     [
                       300,
@@ -52,6 +53,11 @@
                   ]
                 },
                 "video": {
+                  "sizes": null,
+                  "mimes": null
+                },
+                "audio": {
+                  "mimes": null,
                   "sizes": null
                 }
               },
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json b/adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json
index 08cd3f22944..2d42bf5ddd4 100644
--- a/adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json
@@ -32,10 +32,16 @@
             "imp_id": "001",
             "media_types": {
               "banner": {
+                "mimes": null,
                 "sizes": null
               },
               "video": {
-                  "sizes": null
+                "mimes": null,
+                "sizes": null
+              },
+              "audio": {
+                "sizes": null,
+                "mimes": ["audio/mpeg"]
               }
             },
             "zone_id": {

From 6c745fbefa9cb78c4a481a3d710979624cef5ebe Mon Sep 17 00:00:00 2001
From: Dirk Merkel <dirk@resetdigital.co>
Date: Mon, 4 Nov 2024 12:10:03 -0800
Subject: [PATCH 56/75] Fix slice append syntax.

---
 adapters/resetdigital/resetdigital.go | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 5f3f4b1b333..69f0fdd2375 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -46,7 +46,7 @@ type resetDigitalMediaTypes struct {
 }
 type resetDigitalMediaType struct {
 	Sizes [][]int64 `json:"sizes"`
-	Mimes []string `json:"mimes"`
+	Mimes []string  `json:"mimes"`
 }
 type resetDigitalBidResponse struct {
 	Bids []resetDigitalBid `json:"bids"`
@@ -179,15 +179,18 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 				[]int64{tempW, tempH},
 			)
 		}
-		if imp.Video.MIMEs != nil{
+		if imp.Video.MIMEs != nil {
+			// reqData.Imps[0].MediaTypes.Video.Mimes = imp.Video.MIMEs
 			reqData.Imps[0].MediaTypes.Video.Mimes = append(
-				imp.Video.MIMEs,
+				reqData.Imps[0].MediaTypes.Video.Mimes,
+				imp.Video.MIMEs...,
 			)
 		}
 	}
-	if bidType == openrtb_ext.BidTypeAudio && imp.Audio != nil && imp.Audio.MIMEs != nil{
+	if bidType == openrtb_ext.BidTypeAudio && imp.Audio != nil && imp.Audio.MIMEs != nil {
 		reqData.Imps[0].MediaTypes.Audio.Mimes = append(
-			imp.Audio.MIMEs,
+			reqData.Imps[0].MediaTypes.Audio.Mimes,
+			imp.Audio.MIMEs...,
 		)
 	}
 

From 56b03f123d12d3c4679a5f949f566ed600016694 Mon Sep 17 00:00:00 2001
From: Dirk Merkel <dirk@resetdigital.co>
Date: Mon, 4 Nov 2024 12:26:23 -0800
Subject: [PATCH 57/75] Removed zero check for bid response and moved HTTP
 headers into separate conditionals as requested by Brian Sardo.

---
 adapters/resetdigital/resetdigital.go | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 69f0fdd2375..3e56ed460bd 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -78,17 +78,25 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co
 func getHeaders(request *openrtb2.BidRequest) http.Header {
 	headers := http.Header{}
 
-	if request != nil && request.Device != nil && request.Site != nil { // what about request.App? Do we need to do something different with Referrer in the app case assuming we care about app?
+	addNonEmptyHeaders(&headers, map[string]string{
+		"Content-Type": "application/json;charset=utf-8",
+		"Accept":       "application/json",
+	})
+
+	if request != nil && request.Device != nil {
 		addNonEmptyHeaders(&headers, map[string]string{
-			"Referer":         request.Site.Page,
 			"Accept-Language": request.Device.Language,
 			"User-Agent":      request.Device.UA,
 			"X-Forwarded-For": request.Device.IP,
 			"X-Real-Ip":       request.Device.IP,
-			"Content-Type":    "application/json;charset=utf-8",
-			"Accept":          "application/json",
 		})
 	}
+	if request != nil && request.Site != nil {
+		addNonEmptyHeaders(&headers, map[string]string{
+			"Referer": request.Site.Page,
+		})
+	}
+
 	return headers
 }
 
@@ -263,10 +271,6 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R
 }
 
 func getBidFromResponse(bidResponse *resetDigitalBid) (*openrtb2.Bid, error) {
-	if bidResponse.CPM == 0 {
-		// brian to check how to report this
-		return nil, nil
-	}
 
 	bid := &openrtb2.Bid{
 		ID:    bidResponse.BidID,

From 21eecddcf00a3c1eddca416567e3929eb6025b12 Mon Sep 17 00:00:00 2001
From: Dirk Merkel <dirk@resetdigital.co>
Date: Mon, 4 Nov 2024 12:47:00 -0800
Subject: [PATCH 58/75] Adding test case for missing currency to improve test
 coverage percentage.

---
 .../supplemental/missing-currency.json        | 105 ++++++++++++++++++
 1 file changed, 105 insertions(+)
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/missing-currency.json

diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/missing-currency.json b/adapters/resetdigital/resetdigitaltest/supplemental/missing-currency.json
new file mode 100644
index 00000000000..35bf5f7165e
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/missing-currency.json
@@ -0,0 +1,105 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [{
+      "id": "001",
+      "banner": {
+        "h": 300,
+        "w": 250
+      },
+      "ext": {
+        "bidder": {
+          "placement_id": "placement-id-1"
+        }
+      }
+    }],
+    "site": {
+      "domain": "https://test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [{
+    "expectedRequest": {
+      "method": "POST",
+      "body": {
+        "imps": [{
+          "bid_id": "12345",
+          "ext": {
+            "gpid": ""
+          },
+          "imp_id": "001",
+          "media_types": {
+            "banner": {
+              "mimes": null,
+              "sizes": [
+                [
+                  250,
+                  300
+                ]
+              ]
+            },
+            "video": {
+              "mimes": null,
+              "sizes": null
+            },
+            "audio": {
+              "mimes": null,
+              "sizes": null
+            }
+          },
+          "zone_id": {
+            "placementId": "placement-id-1"
+          }
+        }],
+        "site": {
+          "domain": "https://test.com",
+          "referrer": "https://test.com/2016/06/12"
+        }
+      },
+      "impIDs": [
+        "001"
+      ]
+    },
+    "mockResponse": {
+      "status": 200,
+      "body": {
+        "bids": [{
+          "bid_id": "01",
+          "imp_id": "001",
+          "cpm": 1.00,
+          "cid": "1002088",
+          "crid": "1000763-1002088",
+          "adid": "1002088",
+          "w": "300",
+          "h": "250",
+          "seat": "resetdigital",
+          "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
+        }]
+      }
+    }
+  }],
+
+  "expectedBidResponses": [{
+    "currency": "USD",
+    "bids": [{
+      "bid": {
+        "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
+        "cid": "1002088",
+        "crid": "1000763-1002088",
+        "id": "01",
+        "impid": "001",
+        "price": 1.00,
+        "w": 300,
+        "h": 250
+      },
+      "type": "banner",
+      "seat": "resetdigital"
+    }]
+  }]
+}

From 2584c6bac38e3613ffc5cccfcd82bbc6a0d40f90 Mon Sep 17 00:00:00 2001
From: Bruno Jacinto <bruno@siira.world>
Date: Mon, 4 Nov 2024 22:20:19 +0000
Subject: [PATCH 59/75] Changing the version to V3

Making the last version of the objects to the V3 of openRTB
---
 adapters/resetdigital/resetdigital.go      | 6 +++---
 adapters/resetdigital/resetdigital_test.go | 6 +++---
 exchange/adapter_builders.go               | 2 +-
 go.mod                                     | 1 +
 go.sum                                     | 2 ++
 5 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 3e56ed460bd..3aace820035 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -8,9 +8,9 @@ import (
 	"text/template"
 
 	"github.com/prebid/openrtb/v20/openrtb2"
-	"github.com/prebid/prebid-server/v2/adapters"
-	"github.com/prebid/prebid-server/v2/config"
-	"github.com/prebid/prebid-server/v2/openrtb_ext"
+	"github.com/prebid/prebid-server/v3/adapters"
+	"github.com/prebid/prebid-server/v3/config"
+	"github.com/prebid/prebid-server/v3/openrtb_ext"
 )
 
 type adapter struct {
diff --git a/adapters/resetdigital/resetdigital_test.go b/adapters/resetdigital/resetdigital_test.go
index d160e9a23fe..9efba33f301 100644
--- a/adapters/resetdigital/resetdigital_test.go
+++ b/adapters/resetdigital/resetdigital_test.go
@@ -3,9 +3,9 @@ package resetdigital
 import (
 	"testing"
 
-	"github.com/prebid/prebid-server/v2/adapters/adapterstest"
-	"github.com/prebid/prebid-server/v2/config"
-	"github.com/prebid/prebid-server/v2/openrtb_ext"
+	"github.com/prebid/prebid-server/v3/adapters/adapterstest"
+	"github.com/prebid/prebid-server/v3/config"
+	"github.com/prebid/prebid-server/v3/openrtb_ext"
 )
 
 func TestJsonSamples(t *testing.T) {
diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go
index fc76b715be9..aad457beef0 100755
--- a/exchange/adapter_builders.go
+++ b/exchange/adapter_builders.go
@@ -164,6 +164,7 @@ import (
 	"github.com/prebid/prebid-server/v3/adapters/qt"
 	"github.com/prebid/prebid-server/v3/adapters/readpeak"
 	"github.com/prebid/prebid-server/v3/adapters/relevantdigital"
+	"github.com/prebid/prebid-server/v3/adapters/resetdigital"
 	"github.com/prebid/prebid-server/v3/adapters/revcontent"
 	"github.com/prebid/prebid-server/v3/adapters/richaudience"
 	"github.com/prebid/prebid-server/v3/adapters/rise"
@@ -224,7 +225,6 @@ import (
 	"github.com/prebid/prebid-server/v3/adapters/zeta_global_ssp"
 	"github.com/prebid/prebid-server/v3/adapters/zmaticoo"
 	"github.com/prebid/prebid-server/v3/openrtb_ext"
-	"github.com/prebid/prebid-server/v2/adapters/resetdigital"
 )
 
 // Adapter registration is kept in this separate file for ease of use and to aid
diff --git a/go.mod b/go.mod
index e844fe5bf25..c199310739b 100644
--- a/go.mod
+++ b/go.mod
@@ -61,6 +61,7 @@ require (
 	github.com/pelletier/go-toml v1.9.5 // indirect
 	github.com/pelletier/go-toml/v2 v2.0.1 // indirect
 	github.com/pmezard/go-difflib v1.0.0 // indirect
+	github.com/prebid/prebid-server/v2 v2.32.0
 	github.com/prometheus/common v0.32.1 // indirect
 	github.com/prometheus/procfs v0.7.3 // indirect
 	github.com/sergi/go-diff v1.2.0 // indirect
diff --git a/go.sum b/go.sum
index a6a6226c616..00f42ae8bbe 100644
--- a/go.sum
+++ b/go.sum
@@ -410,6 +410,8 @@ github.com/prebid/go-gpp v0.2.0 h1:41Ssxd4Zxr50WgwG1q/1+6awGU3pFnwV7FR4XCLQSuM=
 github.com/prebid/go-gpp v0.2.0/go.mod h1:b0TLoVln+HXFD9L9xeimxIH3FN8WDKPJ42auslxEkow=
 github.com/prebid/openrtb/v20 v20.1.0 h1:Rb+Z3H3UxiqqnjgJK3R9Wt73ibrh7HPzG7ikBckQNqc=
 github.com/prebid/openrtb/v20 v20.1.0/go.mod h1:hLBrA/APkSrxs5MaW639l+y/EAHivDfRagO2TX/wbSc=
+github.com/prebid/prebid-server/v2 v2.32.0 h1:E+zX1CGtWjkUTPQzMKHMEsn26yGDnZI6znG1rgxosQo=
+github.com/prebid/prebid-server/v2 v2.32.0/go.mod h1:wyuZeJWIWtt+D5YWN/CL+t9IklM/Gof5YBs+Urt1tHM=
 github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
 github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
 github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=

From 123cb134141497fcbb1943a4d2715412572bde29 Mon Sep 17 00:00:00 2001
From: dirk-rd <dirk@resetdigital.co>
Date: Wed, 20 Nov 2024 21:34:26 -0800
Subject: [PATCH 60/75] Renaming test JSON files

---
 .../supplemental/{invalid_cur.json => invalid-cur.json}           | 0
 .../{invalid_media_def.json => invalid-media-def.json}            | 0
 .../{invalid_placement_id.json => invalid-placement-id.json}      | 0
 .../{invalid_video_dim.json => invalid-video-dim.json}            | 0
 .../supplemental/{multi_format.json => multi-format.json}         | 0
 .../supplemental/{unknown_media.json => unknown-media.json}       | 0
 6 files changed, 0 insertions(+), 0 deletions(-)
 rename adapters/resetdigital/resetdigitaltest/supplemental/{invalid_cur.json => invalid-cur.json} (100%)
 rename adapters/resetdigital/resetdigitaltest/supplemental/{invalid_media_def.json => invalid-media-def.json} (100%)
 rename adapters/resetdigital/resetdigitaltest/supplemental/{invalid_placement_id.json => invalid-placement-id.json} (100%)
 rename adapters/resetdigital/resetdigitaltest/supplemental/{invalid_video_dim.json => invalid-video-dim.json} (100%)
 rename adapters/resetdigital/resetdigitaltest/supplemental/{multi_format.json => multi-format.json} (100%)
 rename adapters/resetdigital/resetdigitaltest/supplemental/{unknown_media.json => unknown-media.json} (100%)

diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-cur.json
similarity index 100%
rename from adapters/resetdigital/resetdigitaltest/supplemental/invalid_cur.json
rename to adapters/resetdigital/resetdigitaltest/supplemental/invalid-cur.json
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid_media_def.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-media-def.json
similarity index 100%
rename from adapters/resetdigital/resetdigitaltest/supplemental/invalid_media_def.json
rename to adapters/resetdigital/resetdigitaltest/supplemental/invalid-media-def.json
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid_placement_id.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-placement-id.json
similarity index 100%
rename from adapters/resetdigital/resetdigitaltest/supplemental/invalid_placement_id.json
rename to adapters/resetdigital/resetdigitaltest/supplemental/invalid-placement-id.json
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid_video_dim.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-video-dim.json
similarity index 100%
rename from adapters/resetdigital/resetdigitaltest/supplemental/invalid_video_dim.json
rename to adapters/resetdigital/resetdigitaltest/supplemental/invalid-video-dim.json
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json b/adapters/resetdigital/resetdigitaltest/supplemental/multi-format.json
similarity index 100%
rename from adapters/resetdigital/resetdigitaltest/supplemental/multi_format.json
rename to adapters/resetdigital/resetdigitaltest/supplemental/multi-format.json
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json b/adapters/resetdigital/resetdigitaltest/supplemental/unknown-media.json
similarity index 100%
rename from adapters/resetdigital/resetdigitaltest/supplemental/unknown_media.json
rename to adapters/resetdigital/resetdigitaltest/supplemental/unknown-media.json

From 4950da13c1bbac6aff78c82b45b96fc45dd7c78c Mon Sep 17 00:00:00 2001
From: dirk-rd <dirk@resetdigital.co>
Date: Wed, 20 Nov 2024 21:34:59 -0800
Subject: [PATCH 61/75] Deleting errant -vv file

---
 -vv | 78 -------------------------------------------------------------
 1 file changed, 78 deletions(-)
 delete mode 100644 -vv

diff --git a/-vv b/-vv
deleted file mode 100644
index 28f4857db7b..00000000000
--- a/-vv
+++ /dev/null
@@ -1,78 +0,0 @@
-mode: set
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:67.119,69.16 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:69.16,71.3 1 0
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:72.2,75.20 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:78.59,81.68 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:81.68,91.3 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:92.2,92.16 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:95.79,96.39 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:96.39,97.21 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:97.21,99.4 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:103.141,109.38 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:109.38,111.17 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:111.17,113.12 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:116.3,117.17 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:117.17,119.12 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:122.3,123.17 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:123.17,125.12 2 0
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:128.3,134.5 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:137.2,137.25 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:140.139,143.29 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:143.29,146.3 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:148.2,153.63 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:153.63,155.26 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:155.26,157.4 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:158.3,158.26 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:158.26,160.4 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:161.3,161.29 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:161.29,166.4 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:168.2,168.61 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:168.61,170.25 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:170.25,172.4 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:173.3,173.25 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:173.25,175.4 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:176.3,176.29 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:176.29,181.4 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:183.2,183.61 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:183.62,197.3 0 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:199.2,202.60 3 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:202.60,204.3 1 0
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:205.2,205.75 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:205.75,207.3 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:208.2,210.21 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:213.166,214.58 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:214.58,216.3 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:218.2,218.80 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:218.80,220.3 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:222.2,223.69 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:223.69,225.3 1 0
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:227.2,231.34 4 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:231.34,233.3 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:235.2,235.31 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:235.31,240.17 3 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:240.17,243.12 2 0
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:246.3,247.17 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:247.17,249.12 2 0
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:252.3,257.49 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:260.2,260.27 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:260.27,262.3 1 0
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:264.2,264.26 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:267.78,268.26 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:268.26,271.3 1 0
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:273.2,283.16 3 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:283.16,285.3 1 0
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:286.2,289.16 3 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:289.16,291.3 1 0
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:292.2,293.17 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:296.64,297.23 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:297.23,299.3 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:299.8,299.29 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:299.29,301.3 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:301.8,301.29 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:301.29,303.3 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:305.2,305.73 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:308.104,311.41 2 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:311.41,312.50 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:312.50,316.4 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:317.3,317.24 1 1
-github.com/prebid/prebid-server/v2/adapters/resetdigital/resetdigital.go:319.2,319.73 1 0

From cc06d05d7feed197f1e035e58ccf5a2f6a2b0a4d Mon Sep 17 00:00:00 2001
From: dirk-rd <dirk@resetdigital.co>
Date: Thu, 21 Nov 2024 08:28:33 -0800
Subject: [PATCH 62/75] Simplying HTML test markup.

---
 .../resetdigital/resetdigitaltest/exemplary/simple-audio.json | 4 ++--
 .../resetdigitaltest/exemplary/simple-banner.json             | 4 ++--
 .../resetdigital/resetdigitaltest/exemplary/simple-video.json | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-audio.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-audio.json
index 80ae00517f6..d848bf29b29 100644
--- a/adapters/resetdigital/resetdigitaltest/exemplary/simple-audio.json
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-audio.json
@@ -154,7 +154,7 @@
               "w": "0",
               "h": "0",
               "seat": "resetdigital",
-              "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
+              "html": "test markup"
             }
           ]
         }
@@ -167,7 +167,7 @@
       "bids": [
         {
           "bid": {
-            "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
+            "adm": "test markup",
             "cid": "1000048-1002918",
             "crid": "1003893",
             "id": "01",
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
index 2e4a54c8a57..8e46be18e3a 100644
--- a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
@@ -82,7 +82,7 @@
           "w": "300",
           "h": "250",
           "seat": "resetdigital",
-          "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
+          "html": "test markup"
         }]
       }
     }
@@ -92,7 +92,7 @@
     "currency": "USD",
     "bids": [{
       "bid": {
-        "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
+        "adm": "test markup",
         "cid": "1002088",
         "crid": "1000763-1002088",
         "id": "01",
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json
index 0310ed18c46..d4d9520f483 100644
--- a/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json
@@ -95,7 +95,7 @@
               "w": "900",
               "h": "250",
               "seat": "resetdigital",
-              "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
+              "html": "test markup"
             }
           ]
         }
@@ -108,7 +108,7 @@
       "bids": [
         {
           "bid": {
-            "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
+            "adm": "test markup",
             "cid": "1002088",
             "crid": "1000763-1002088",
             "id": "01",

From 330d84f030947dc1448af1e8f7db61820e34e135 Mon Sep 17 00:00:00 2001
From: dirk-rd <dirk@resetdigital.co>
Date: Sun, 24 Nov 2024 17:48:58 -0800
Subject: [PATCH 63/75] Reverting unnecessary changes.

---
 go.mod | 1 -
 go.sum | 2 --
 2 files changed, 3 deletions(-)

diff --git a/go.mod b/go.mod
index c199310739b..e844fe5bf25 100644
--- a/go.mod
+++ b/go.mod
@@ -61,7 +61,6 @@ require (
 	github.com/pelletier/go-toml v1.9.5 // indirect
 	github.com/pelletier/go-toml/v2 v2.0.1 // indirect
 	github.com/pmezard/go-difflib v1.0.0 // indirect
-	github.com/prebid/prebid-server/v2 v2.32.0
 	github.com/prometheus/common v0.32.1 // indirect
 	github.com/prometheus/procfs v0.7.3 // indirect
 	github.com/sergi/go-diff v1.2.0 // indirect
diff --git a/go.sum b/go.sum
index 00f42ae8bbe..a6a6226c616 100644
--- a/go.sum
+++ b/go.sum
@@ -410,8 +410,6 @@ github.com/prebid/go-gpp v0.2.0 h1:41Ssxd4Zxr50WgwG1q/1+6awGU3pFnwV7FR4XCLQSuM=
 github.com/prebid/go-gpp v0.2.0/go.mod h1:b0TLoVln+HXFD9L9xeimxIH3FN8WDKPJ42auslxEkow=
 github.com/prebid/openrtb/v20 v20.1.0 h1:Rb+Z3H3UxiqqnjgJK3R9Wt73ibrh7HPzG7ikBckQNqc=
 github.com/prebid/openrtb/v20 v20.1.0/go.mod h1:hLBrA/APkSrxs5MaW639l+y/EAHivDfRagO2TX/wbSc=
-github.com/prebid/prebid-server/v2 v2.32.0 h1:E+zX1CGtWjkUTPQzMKHMEsn26yGDnZI6znG1rgxosQo=
-github.com/prebid/prebid-server/v2 v2.32.0/go.mod h1:wyuZeJWIWtt+D5YWN/CL+t9IklM/Gof5YBs+Urt1tHM=
 github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
 github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
 github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=

From 17cf6c81445fcb2f418a72cd4cfc423cbe6851af Mon Sep 17 00:00:00 2001
From: dirk-rd <dirk@resetdigital.co>
Date: Sun, 1 Dec 2024 14:18:46 -0800
Subject: [PATCH 64/75] Adding test cases via JSON to increase coverage.

---
 .../supplemental/invalid-bid-height.json      |  91 ++++++++++++++++
 .../supplemental/invalid-bid-media-type.json  | 102 ++++++++++++++++++
 .../supplemental/invalid-bid-width.json       |  91 ++++++++++++++++
 3 files changed, 284 insertions(+)
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-height.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-media-type.json
 create mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-width.json

diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-height.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-height.json
new file mode 100644
index 00000000000..c197f9cb7da
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-height.json
@@ -0,0 +1,91 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [{
+      "id": "001",
+      "banner": {
+        "h": 300,
+        "w": 250
+      },
+      "ext": {
+        "bidder": {
+          "placement_id": "placement-id-1"
+        }
+      }
+    }],
+    "site": {
+      "domain": "https://test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "cur": [
+      "USD"
+    ],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [{
+    "expectedRequest": {
+      "method": "POST",
+      "body": {
+        "imps": [{
+          "bid_id": "12345",
+          "ext": {
+            "gpid": ""
+          },
+          "imp_id": "001",
+          "media_types": {
+            "banner": {
+              "sizes": [
+                [
+                  250,
+                  300
+                ]
+              ]
+            },
+            "video": {},
+            "audio": {}
+          },
+          "zone_id": {
+            "placementId": "placement-id-1"
+          }
+        }],
+        "site": {
+          "domain": "https://test.com",
+          "referrer": "https://test.com/2016/06/12"
+        }
+      },
+      "impIDs": [
+        "001"
+      ]
+    },
+    "mockResponse": {
+      "status": 200,
+      "body": {
+        "bids": [{
+          "bid_id": "01",
+          "imp_id": "001",
+          "cpm": 1.00,
+          "cid": "1002088",
+          "crid": "1000763-1002088",
+          "adid": "1002088",
+          "w": "300",
+          "h": "123456789012345678901234567890123456789012345678901234567890",
+          "seat": "resetdigital",
+          "html": "test markup"
+        }]
+      }
+    }
+  }],
+
+  "expectedMakeBidsErrors": [
+    {
+      "value": "strconv.ParseInt: parsing \"123456789012345678901234567890123456789012345678901234567890\": value out of range",
+      "comparison": "literal"
+    }
+  ],
+  "expectedBidResponses": [{}]
+}
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-media-type.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-media-type.json
new file mode 100644
index 00000000000..913350860b9
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-media-type.json
@@ -0,0 +1,102 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [{
+      "id": "001",
+      "banner": {
+        "h": 300,
+        "w": 250
+      },
+      "ext": {
+        "bidder": {
+          "placement_id": "placement-id-1"
+        }
+      }
+    }],
+    "site": {
+      "domain": "https://test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "cur": [
+      "USD"
+    ],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [{
+    "expectedRequest": {
+      "method": "POST",
+      "body": {
+        "imps": [{
+          "bid_id": "12345",
+          "ext": {
+            "gpid": ""
+          },
+          "imp_id": "001",
+          "media_types": {
+            "banner": {
+              "sizes": [
+                [
+                  250,
+                  300
+                ]
+              ]
+            },
+            "video": {},
+            "audio": {}
+          },
+          "zone_id": {
+            "placementId": "placement-id-1"
+          }
+        }],
+        "site": {
+          "domain": "https://test.com",
+          "referrer": "https://test.com/2016/06/12"
+        }
+      },
+      "impIDs": [
+        "001"
+      ]
+    },
+    "mockResponse": {
+      "status": 200,
+      "body": {
+        "bids": [{
+          "bid_id": "01",
+          "imp_id": "001",
+          "cpm": 1.00,
+          "cid": "1002088",
+          "crid": "1000763-1002088",
+          "adid": "1002088",
+          "w": "300",
+          "h": "250",
+          "seat": "resetdigital",
+          "html": "test markup",
+          "mtype": "native"
+        }]
+      }
+    }
+  }],
+
+  "expectedBidResponses": [{
+    "currency": "USD",
+    "bids": [{
+      "bid": {
+        "adm": "test markup",
+        "cid": "1002088",
+        "crid": "1000763-1002088",
+        "id": "01",
+        "impid": "001",
+        "price": 1.00,
+        "w": 300,
+        "h": 250
+      },
+      "type": "banner",
+      "seat": "resetdigital"
+    }]
+  }]
+}
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-width.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-width.json
new file mode 100644
index 00000000000..bba60c6bdac
--- /dev/null
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-width.json
@@ -0,0 +1,91 @@
+{
+  "mockBidRequest": {
+    "id": "12345",
+    "imp": [{
+      "id": "001",
+      "banner": {
+        "h": 300,
+        "w": 250
+      },
+      "ext": {
+        "bidder": {
+          "placement_id": "placement-id-1"
+        }
+      }
+    }],
+    "site": {
+      "domain": "https://test.com",
+      "page": "https://test.com/2016/06/12"
+    },
+    "cur": [
+      "USD"
+    ],
+    "device": {
+      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
+      "ip": "127.0.0.1",
+      "language": "EN"
+    },
+    "tmax": 500
+  },
+  "httpCalls": [{
+    "expectedRequest": {
+      "method": "POST",
+      "body": {
+        "imps": [{
+          "bid_id": "12345",
+          "ext": {
+            "gpid": ""
+          },
+          "imp_id": "001",
+          "media_types": {
+            "banner": {
+              "sizes": [
+                [
+                  250,
+                  300
+                ]
+              ]
+            },
+            "video": {},
+            "audio": {}
+          },
+          "zone_id": {
+            "placementId": "placement-id-1"
+          }
+        }],
+        "site": {
+          "domain": "https://test.com",
+          "referrer": "https://test.com/2016/06/12"
+        }
+      },
+      "impIDs": [
+        "001"
+      ]
+    },
+    "mockResponse": {
+      "status": 200,
+      "body": {
+        "bids": [{
+          "bid_id": "01",
+          "imp_id": "001",
+          "cpm": 1.00,
+          "cid": "1002088",
+          "crid": "1000763-1002088",
+          "adid": "1002088",
+          "w": "123456789012345678901234567890123456789012345678901234567890",
+          "h": "250",
+          "seat": "resetdigital",
+          "html": "test markup"
+        }]
+      }
+    }
+  }],
+
+  "expectedMakeBidsErrors": [
+    {
+      "value": "strconv.ParseInt: parsing \"123456789012345678901234567890123456789012345678901234567890\": value out of range",
+      "comparison": "literal"
+    }
+  ],
+  "expectedBidResponses": [{}]
+}

From 5b4428048a9f725bd025ae036f173b517760286a Mon Sep 17 00:00:00 2001
From: dirk-rd <dirk@resetdigital.co>
Date: Sun, 1 Dec 2024 14:21:53 -0800
Subject: [PATCH 65/75] Removing keys with null values.

---
 .../resetdigitaltest/exemplary/simple-audio.json  | 11 ++---------
 .../resetdigitaltest/exemplary/simple-banner.json | 11 ++---------
 .../resetdigitaltest/exemplary/simple-video.json  | 10 ++--------
 .../supplemental/invalid-cur.json                 | 11 ++---------
 .../supplemental/invalid-device.json              | 11 ++---------
 .../supplemental/invalid-video-dim.json           | 11 ++---------
 .../supplemental/missing-currency.json            | 15 ++++-----------
 .../supplemental/multi-format.json                | 11 ++---------
 .../supplemental/unknown-media.json               | 11 ++---------
 9 files changed, 20 insertions(+), 82 deletions(-)

diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-audio.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-audio.json
index d848bf29b29..d032b4c6f37 100644
--- a/adapters/resetdigital/resetdigitaltest/exemplary/simple-audio.json
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-audio.json
@@ -108,16 +108,9 @@
               },
               "imp_id": "001",
               "media_types": {
-                "banner": {
-                  "sizes": null,
-                  "mimes": null
-                },
-                "video": {
-                  "sizes": null,
-                  "mimes": null
-                },
+                "banner": {},
+                "video": {},
                 "audio": {
-                  "sizes": null,
                   "mimes": [
                     "audio/mp4",
                     "audio/mp3"
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
index 8e46be18e3a..2a0fcacd558 100644
--- a/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-banner.json
@@ -39,7 +39,6 @@
           "imp_id": "001",
           "media_types": {
             "banner": {
-              "mimes": null,
               "sizes": [
                 [
                   250,
@@ -47,14 +46,8 @@
                 ]
               ]
             },
-            "video": {
-              "mimes": null,
-              "sizes": null
-            },
-            "audio": {
-              "mimes": null,
-              "sizes": null
-            }
+            "audio": {},
+            "video": {}
           },
           "zone_id": {
             "placementId": "placement-id-1"
diff --git a/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json b/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json
index d4d9520f483..ce4e1916fd1 100644
--- a/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json
+++ b/adapters/resetdigital/resetdigitaltest/exemplary/simple-video.json
@@ -46,10 +46,7 @@
               },
               "imp_id": "001",
               "media_types": {
-                "banner": {
-                  "mimes": null,
-                  "sizes": null
-                },
+                "banner": {},
                 "video": {
                   "sizes": [
                     [
@@ -62,10 +59,7 @@
                     "video/mp4"
                   ]
                 },
-                "audio": {
-                  "mimes": null,
-                  "sizes": null
-                }
+                "audio": {}
               },
               "zone_id": {
                 "placementId": "placement-id-1"
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-cur.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-cur.json
index 878d9c07289..3dcf7a76566 100644
--- a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-cur.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-cur.json
@@ -35,7 +35,6 @@
               "imp_id": "001",
               "media_types": {
                 "banner": {
-                  "mimes": null,
                   "sizes": [
                     [
                       250,
@@ -43,14 +42,8 @@
                     ]
                   ]
                 },
-                "video": {
-                  "mimes": null,
-                  "sizes": null
-                },
-                "audio": {
-                  "mimes": null,
-                  "sizes": null
-                }
+                "video": {},
+                "audio": {}
               },
               "zone_id": {
                 "placementId": "placement-id-1"
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json
index fca85c84d4a..7b0fc8c2645 100644
--- a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-device.json
@@ -33,7 +33,6 @@
             "imp_id": "001",
             "media_types": {
               "banner": {
-                "mimes": null,
                 "sizes": [
                   [
                     250,
@@ -41,14 +40,8 @@
                   ]
                 ]
               },
-              "video": {
-                "mimes": null,
-                "sizes": null
-              },
-              "audio": {
-                "mimes": null,
-                "sizes": null
-              }
+              "video": {},
+              "audio": {}
             },
             "zone_id": {
               "placementId": "placement-id-1"
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-video-dim.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-video-dim.json
index 9a955ccb6a2..4e1f43d13fb 100644
--- a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-video-dim.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-video-dim.json
@@ -43,21 +43,14 @@
             },
             "imp_id": "001",
             "media_types": {
-              "banner": {
-                "mimes": null,
-                "sizes": null
-              },
+              "banner": {},
               "video": {
-                "sizes": null,
                 "mimes": [
                   "video/x-flv",
                   "video/mp4"
                 ]
               },
-              "audio": {
-                "mimes": null,
-                "sizes": null
-              }
+              "audio": {}
             },
             "zone_id": {
               "placementId": "placement-id-1"
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/missing-currency.json b/adapters/resetdigital/resetdigitaltest/supplemental/missing-currency.json
index 35bf5f7165e..bd438f78574 100644
--- a/adapters/resetdigital/resetdigitaltest/supplemental/missing-currency.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/missing-currency.json
@@ -36,7 +36,6 @@
           "imp_id": "001",
           "media_types": {
             "banner": {
-              "mimes": null,
               "sizes": [
                 [
                   250,
@@ -44,14 +43,8 @@
                 ]
               ]
             },
-            "video": {
-              "mimes": null,
-              "sizes": null
-            },
-            "audio": {
-              "mimes": null,
-              "sizes": null
-            }
+            "video": {},
+            "audio": {}
           },
           "zone_id": {
             "placementId": "placement-id-1"
@@ -79,7 +72,7 @@
           "w": "300",
           "h": "250",
           "seat": "resetdigital",
-          "html": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />"
+          "html": "test markup"
         }]
       }
     }
@@ -89,7 +82,7 @@
     "currency": "USD",
     "bids": [{
       "bid": {
-        "adm": "<script src=\"https://data.resetdigital.co/evts?S0B=1&R0E=1&R0M=3_3&testad=US-HEADER-04&R0A=1000048_1001096_1001117_1627360746&R0P=resetio_1234_muscleandfitness.com_Site_1_Banner&R0L=*_*_*_*_*&R0D=*_*_*_*_*_*&R0B=*_*_*\" type=\"text/javascript\"></script><image src='https://adsreq.resetdigital.co?brid=0000000000000001' /><image src='https://sync2.resetdigital.co/hbsync?ck=0000000000000001' />",
+        "adm": "test markup",
         "cid": "1002088",
         "crid": "1000763-1002088",
         "id": "01",
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/multi-format.json b/adapters/resetdigital/resetdigitaltest/supplemental/multi-format.json
index 66a441f6506..d2a4f1c5ed0 100644
--- a/adapters/resetdigital/resetdigitaltest/supplemental/multi-format.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/multi-format.json
@@ -44,7 +44,6 @@
               "imp_id": "001",
               "media_types": {
                 "banner": {
-                  "mimes": null,
                   "sizes": [
                     [
                       300,
@@ -52,14 +51,8 @@
                     ]
                   ]
                 },
-                "video": {
-                  "sizes": null,
-                  "mimes": null
-                },
-                "audio": {
-                  "mimes": null,
-                  "sizes": null
-                }
+                "video": {},
+                "audio": {}
               },
               "zone_id": {
                 "placementId": "placement-id-1"
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/unknown-media.json b/adapters/resetdigital/resetdigitaltest/supplemental/unknown-media.json
index 2d42bf5ddd4..5d9fb57363d 100644
--- a/adapters/resetdigital/resetdigitaltest/supplemental/unknown-media.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/unknown-media.json
@@ -31,16 +31,9 @@
             },
             "imp_id": "001",
             "media_types": {
-              "banner": {
-                "mimes": null,
-                "sizes": null
-              },
-              "video": {
-                "mimes": null,
-                "sizes": null
-              },
+              "banner": {},
+              "video": {},
               "audio": {
-                "sizes": null,
                 "mimes": ["audio/mpeg"]
               }
             },

From ee3546c351baca145f101b0489263ccc41edeb91 Mon Sep 17 00:00:00 2001
From: dirk-rd <dirk@resetdigital.co>
Date: Sun, 1 Dec 2024 14:22:28 -0800
Subject: [PATCH 66/75] Removing unnecessary keys and fixing redirect URL.

---
 static/bidder-info/resetdigital.yaml | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/static/bidder-info/resetdigital.yaml b/static/bidder-info/resetdigital.yaml
index 3c4a206389a..db4e70ae768 100644
--- a/static/bidder-info/resetdigital.yaml
+++ b/static/bidder-info/resetdigital.yaml
@@ -9,8 +9,6 @@ capabilities:
     - audio
 gvlVendorID: 1162
 userSync:
-  key: resetdigital
-  supportCors: false
   redirect:
-    url: https://sync.resetdigital.co/csync?pid=rubicon&redir={{redirect_url}}
+    url: https://sync.resetdigital.co/csync?redir={{.RedirectURL}}
     userMacro: '$USER_ID'

From 2ecc9a8d54d341fc5b03d4c0d780c8cff2215d9b Mon Sep 17 00:00:00 2001
From: dirk-rd <dirk@resetdigital.co>
Date: Sun, 1 Dec 2024 14:28:14 -0800
Subject: [PATCH 67/75] Ignore test coverage output.

---
 adapters/resetdigital/.gitignore | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 adapters/resetdigital/.gitignore

diff --git a/adapters/resetdigital/.gitignore b/adapters/resetdigital/.gitignore
new file mode 100644
index 00000000000..36331304238
--- /dev/null
+++ b/adapters/resetdigital/.gitignore
@@ -0,0 +1,2 @@
+# Ignore test coverage output
+cover.out

From 0a4d9bc65b4385fd6424b450885b3f9651fd21af Mon Sep 17 00:00:00 2001
From: dirk-rd <dirk@resetdigital.co>
Date: Sun, 1 Dec 2024 15:29:21 -0800
Subject: [PATCH 68/75] Remove unnecessary test case.

---
 .../supplemental/invalid-bid-media-type.json  | 102 ------------------
 .../supplemental/multi-format.json            |   2 +-
 2 files changed, 1 insertion(+), 103 deletions(-)
 delete mode 100644 adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-media-type.json

diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-media-type.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-media-type.json
deleted file mode 100644
index 913350860b9..00000000000
--- a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-media-type.json
+++ /dev/null
@@ -1,102 +0,0 @@
-{
-  "mockBidRequest": {
-    "id": "12345",
-    "imp": [{
-      "id": "001",
-      "banner": {
-        "h": 300,
-        "w": 250
-      },
-      "ext": {
-        "bidder": {
-          "placement_id": "placement-id-1"
-        }
-      }
-    }],
-    "site": {
-      "domain": "https://test.com",
-      "page": "https://test.com/2016/06/12"
-    },
-    "cur": [
-      "USD"
-    ],
-    "device": {
-      "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
-      "ip": "127.0.0.1",
-      "language": "EN"
-    },
-    "tmax": 500
-  },
-  "httpCalls": [{
-    "expectedRequest": {
-      "method": "POST",
-      "body": {
-        "imps": [{
-          "bid_id": "12345",
-          "ext": {
-            "gpid": ""
-          },
-          "imp_id": "001",
-          "media_types": {
-            "banner": {
-              "sizes": [
-                [
-                  250,
-                  300
-                ]
-              ]
-            },
-            "video": {},
-            "audio": {}
-          },
-          "zone_id": {
-            "placementId": "placement-id-1"
-          }
-        }],
-        "site": {
-          "domain": "https://test.com",
-          "referrer": "https://test.com/2016/06/12"
-        }
-      },
-      "impIDs": [
-        "001"
-      ]
-    },
-    "mockResponse": {
-      "status": 200,
-      "body": {
-        "bids": [{
-          "bid_id": "01",
-          "imp_id": "001",
-          "cpm": 1.00,
-          "cid": "1002088",
-          "crid": "1000763-1002088",
-          "adid": "1002088",
-          "w": "300",
-          "h": "250",
-          "seat": "resetdigital",
-          "html": "test markup",
-          "mtype": "native"
-        }]
-      }
-    }
-  }],
-
-  "expectedBidResponses": [{
-    "currency": "USD",
-    "bids": [{
-      "bid": {
-        "adm": "test markup",
-        "cid": "1002088",
-        "crid": "1000763-1002088",
-        "id": "01",
-        "impid": "001",
-        "price": 1.00,
-        "w": 300,
-        "h": 250
-      },
-      "type": "banner",
-      "seat": "resetdigital"
-    }]
-  }]
-}
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/multi-format.json b/adapters/resetdigital/resetdigitaltest/supplemental/multi-format.json
index d2a4f1c5ed0..4de554752ff 100644
--- a/adapters/resetdigital/resetdigitaltest/supplemental/multi-format.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/multi-format.json
@@ -99,7 +99,7 @@
           "w": 300,
           "h": 250
         },
-        "type": "banner",
+        "type": "video",
         "seat": "resetdigital"
       }]
     }]

From b93dca3827522834864cd8d02a87eda4e153fe1a Mon Sep 17 00:00:00 2001
From: dirk-rd <dirk@resetdigital.co>
Date: Sun, 1 Dec 2024 15:30:39 -0800
Subject: [PATCH 69/75] Formattting; removed comments; simplified
 GetMediaTypeForImp.

---
 adapters/resetdigital/resetdigital.go | 61 ++++++++++-----------------
 1 file changed, 23 insertions(+), 38 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index 3aace820035..fec83a1e0ec 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -40,13 +40,13 @@ type resetDigitalImpExt struct {
 	Gpid string `json:"gpid"`
 }
 type resetDigitalMediaTypes struct {
-	Banner resetDigitalMediaType `json:"banner"`
-	Video  resetDigitalMediaType `json:"video"`
-	Audio  resetDigitalMediaType `json:"audio"`
+	Banner resetDigitalMediaType `json:"banner,omitempty"`
+	Video  resetDigitalMediaType `json:"video,omitempty"`
+	Audio  resetDigitalMediaType `json:"audio,omitempty"`
 }
 type resetDigitalMediaType struct {
-	Sizes [][]int64 `json:"sizes"`
-	Mimes []string  `json:"mimes"`
+	Sizes [][]int64 `json:"sizes,omitempty"`
+	Mimes []string  `json:"mimes,omitempty"`
 }
 type resetDigitalBidResponse struct {
 	Bids []resetDigitalBid `json:"bids"`
@@ -128,6 +128,7 @@ func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *ad
 		}
 
 		requestBody, err := json.Marshal(splittedRequestData)
+
 		if err != nil {
 			errors = append(errors, err)
 			continue
@@ -153,10 +154,10 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 		reqData.Site.Referrer = requestData.Site.Page
 	}
 
-	reqData.Imps = append(reqData.Imps, resetDigitalImp{
+	rdImp := resetDigitalImp{
 		BidID: requestData.ID,
 		ImpID: imp.ID,
-	})
+	}
 
 	if bidType == openrtb_ext.BidTypeBanner && imp.Banner != nil {
 		var tempH, tempW int64
@@ -167,10 +168,7 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 			tempW = *imp.Banner.W
 		}
 		if tempH > 0 && tempW > 0 {
-			reqData.Imps[0].MediaTypes.Banner.Sizes = append(
-				reqData.Imps[0].MediaTypes.Banner.Sizes,
-				[]int64{tempW, tempH},
-			)
+			rdImp.MediaTypes.Banner.Sizes = append(rdImp.MediaTypes.Banner.Sizes, []int64{tempW, tempH})
 		}
 	}
 	if bidType == openrtb_ext.BidTypeVideo && imp.Video != nil {
@@ -182,24 +180,14 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 			tempW = *imp.Video.W
 		}
 		if tempH > 0 && tempW > 0 {
-			reqData.Imps[0].MediaTypes.Video.Sizes = append(
-				reqData.Imps[0].MediaTypes.Video.Sizes,
-				[]int64{tempW, tempH},
-			)
+			rdImp.MediaTypes.Video.Sizes = append(rdImp.MediaTypes.Video.Sizes, []int64{tempW, tempH})
 		}
 		if imp.Video.MIMEs != nil {
-			// reqData.Imps[0].MediaTypes.Video.Mimes = imp.Video.MIMEs
-			reqData.Imps[0].MediaTypes.Video.Mimes = append(
-				reqData.Imps[0].MediaTypes.Video.Mimes,
-				imp.Video.MIMEs...,
-			)
+			rdImp.MediaTypes.Video.Mimes = append(rdImp.MediaTypes.Video.Mimes, imp.Video.MIMEs...)
 		}
 	}
 	if bidType == openrtb_ext.BidTypeAudio && imp.Audio != nil && imp.Audio.MIMEs != nil {
-		reqData.Imps[0].MediaTypes.Audio.Mimes = append(
-			reqData.Imps[0].MediaTypes.Audio.Mimes,
-			imp.Audio.MIMEs...,
-		)
+		rdImp.MediaTypes.Audio.Mimes = append(rdImp.MediaTypes.Audio.Mimes, imp.Audio.MIMEs...)
 	}
 
 	var bidderExt adapters.ExtImpBidder
@@ -211,7 +199,9 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
 	if err := json.Unmarshal(bidderExt.Bidder, &resetDigitalExt); err != nil {
 		return resetDigitalRequest{}, err
 	}
-	reqData.Imps[0].ZoneID.PlacementID = resetDigitalExt.PlacementID
+	rdImp.ZoneID.PlacementID = resetDigitalExt.PlacementID
+
+	reqData.Imps = append(reqData.Imps, rdImp)
 
 	return reqData, nil
 }
@@ -242,14 +232,12 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R
 		resetDigitalBid := &response.Bids[i]
 
 		bid, err := getBidFromResponse(resetDigitalBid)
-		// handle the error
 		if bid == nil {
-			// it would be better to return an error here
 			errs = append(errs, err)
 			continue
 		}
 
-		bidType, err := GetMediaTypeForImp(requestImps, bid.ImpID)
+		bidType, err := GetMediaTypeForImp(requestImps[bid.ImpID])
 		if err != nil {
 			errs = append(errs, err)
 			continue
@@ -307,16 +295,13 @@ func getBidType(imp openrtb2.Imp) (openrtb_ext.BidType, error) {
 	return "", fmt.Errorf("failed to find matching imp for bid %s", imp.ID)
 }
 
-func GetMediaTypeForImp(reqImps map[string]openrtb2.Imp, bidImpID string) (openrtb_ext.BidType, error) {
-	mediaType := openrtb_ext.BidTypeBanner
+func GetMediaTypeForImp(reqImp openrtb2.Imp) (openrtb_ext.BidType, error) {
 
-	if reqImp, ok := reqImps[bidImpID]; ok {
-		if reqImp.Banner == nil && reqImp.Video != nil {
-			mediaType = openrtb_ext.BidTypeVideo
-		} else if reqImp.Audio != nil {
-			mediaType = openrtb_ext.BidTypeAudio
-		}
-		return mediaType, nil
+	if reqImp.Video != nil {
+		return openrtb_ext.BidTypeVideo, nil
+	}
+	if reqImp.Audio != nil {
+		return openrtb_ext.BidTypeAudio, nil
 	}
-	return "", fmt.Errorf("unknown media type for bid imp ID %s", bidImpID)
+	return openrtb_ext.BidTypeBanner, nil
 }

From 62f74c1de03edaa4cd6f195e5274f75244a49e36 Mon Sep 17 00:00:00 2001
From: dirk-rd <dirk@resetdigital.co>
Date: Sat, 21 Dec 2024 16:44:43 -0800
Subject: [PATCH 70/75] Move line to restore alpha order.

---
 exchange/adapter_builders.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go
index aad457beef0..d200aadaeb7 100755
--- a/exchange/adapter_builders.go
+++ b/exchange/adapter_builders.go
@@ -397,8 +397,8 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder {
 		openrtb_ext.BidderQT:                qt.Builder,
 		openrtb_ext.BidderReadpeak:          readpeak.Builder,
 		openrtb_ext.BidderRelevantDigital:   relevantdigital.Builder,
-		openrtb_ext.BidderRevcontent:        revcontent.Builder,
 		openrtb_ext.BidderResetDigital:      resetdigital.Builder,
+		openrtb_ext.BidderRevcontent:        revcontent.Builder,
 		openrtb_ext.BidderRichaudience:      richaudience.Builder,
 		openrtb_ext.BidderRise:              rise.Builder,
 		openrtb_ext.BidderRoulax:            roulax.Builder,

From 4a0ec3f2b790237ec152484a721d16d060768679 Mon Sep 17 00:00:00 2001
From: dirk-rd <dirk@resetdigital.co>
Date: Sat, 21 Dec 2024 16:56:05 -0800
Subject: [PATCH 71/75] Removing error return value that is no longer used.

---
 adapters/resetdigital/resetdigital.go | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index fec83a1e0ec..e3d7b7419cb 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -237,11 +237,7 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R
 			continue
 		}
 
-		bidType, err := GetMediaTypeForImp(requestImps[bid.ImpID])
-		if err != nil {
-			errs = append(errs, err)
-			continue
-		}
+		bidType := GetMediaTypeForImp(requestImps[bid.ImpID])
 
 		b := &adapters.TypedBid{
 			Bid:     bid,
@@ -295,13 +291,13 @@ func getBidType(imp openrtb2.Imp) (openrtb_ext.BidType, error) {
 	return "", fmt.Errorf("failed to find matching imp for bid %s", imp.ID)
 }
 
-func GetMediaTypeForImp(reqImp openrtb2.Imp) (openrtb_ext.BidType, error) {
+func GetMediaTypeForImp(reqImp openrtb2.Imp) openrtb_ext.BidType {
 
 	if reqImp.Video != nil {
-		return openrtb_ext.BidTypeVideo, nil
+		return openrtb_ext.BidTypeVideo
 	}
 	if reqImp.Audio != nil {
-		return openrtb_ext.BidTypeAudio, nil
+		return openrtb_ext.BidTypeAudio
 	}
-	return openrtb_ext.BidTypeBanner, nil
+	return openrtb_ext.BidTypeBanner
 }

From 11c824f4d9c2851273ec3944351a99dcb745a14c Mon Sep 17 00:00:00 2001
From: dirk-rd <dirk@resetdigital.co>
Date: Sat, 21 Dec 2024 16:56:50 -0800
Subject: [PATCH 72/75] Removing .gitignore file.

---
 adapters/resetdigital/.gitignore | 2 --
 1 file changed, 2 deletions(-)
 delete mode 100644 adapters/resetdigital/.gitignore

diff --git a/adapters/resetdigital/.gitignore b/adapters/resetdigital/.gitignore
deleted file mode 100644
index 36331304238..00000000000
--- a/adapters/resetdigital/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore test coverage output
-cover.out

From 905485dfb2710a3bfc0e2d6d645a48e9a0fca547 Mon Sep 17 00:00:00 2001
From: dirk-rd <dirk@resetdigital.co>
Date: Sun, 22 Dec 2024 07:28:27 -0800
Subject: [PATCH 73/75] Adding required file paras_test.go to test for
 (in)valid parameters.

---
 adapters/resetdigital/params_test.go | 58 ++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 adapters/resetdigital/params_test.go

diff --git a/adapters/resetdigital/params_test.go b/adapters/resetdigital/params_test.go
new file mode 100644
index 00000000000..4098b444934
--- /dev/null
+++ b/adapters/resetdigital/params_test.go
@@ -0,0 +1,58 @@
+package resetdigital
+
+import (
+	"encoding/json"
+	"testing"
+
+	"github.com/prebid/prebid-server/v3/openrtb_ext"
+)
+
+// TestValidParams tests valid parameter(s) declared in openrtb_ext/imp_resetdigital.go
+func TestValidParams(t *testing.T) {
+	validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params")
+	if err != nil {
+		t.Fatalf("Failed to fetch the json-schemas. %v", err)
+	}
+
+	for _, validParam := range validParams {
+		if err := validator.Validate(openrtb_ext.BidderResetDigital, json.RawMessage(validParam)); err != nil {
+			t.Errorf("Schema rejected ResetDigital params: %s \n Error: %s", validParam, err)
+		}
+	}
+}
+
+// TestValidParams tests invalid parameter(s) declared in openrtb_ext/imp_resetdigital.go
+func TestInvalidParams(t *testing.T) {
+	validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params")
+	if err != nil {
+		t.Fatalf("Failed to fetch the json-schemas. %v", err)
+	}
+
+	for _, invalidParam := range invalidParams {
+		if err := validator.Validate(openrtb_ext.BidderResetDigital, json.RawMessage(invalidParam)); err == nil {
+			t.Errorf("Schema allowed unexpected ResetDigital params: %s", invalidParam)
+		}
+	}
+}
+
+// list of valid parameter(s) test cases
+var validParams = []string{
+	`{"placement_id":"1000"}`,
+	`{"placement_id":"0"}`,
+	`{"placement_id":"abc"}`,
+	`{"placement_id":"123abc"}`,
+	`{}`,
+	`{"cp":"1000"}`,
+}
+
+// list of invalid parameter(s) test cases
+var invalidParams = []string{
+	``,
+	`null`,
+	`true`,
+	`5`,
+	`4.2`,
+	`[]`,
+	`{"placement_id":}`,
+	`{"placement_id":""}`,
+}

From e82c8381b49459237aa90ceb79d919f907bba76b Mon Sep 17 00:00:00 2001
From: dirk-rd <dirk@resetdigital.co>
Date: Fri, 10 Jan 2025 13:23:21 -0800
Subject: [PATCH 74/75] Refactoring MakeBids() for single bid request and
 updating JSON tests accordingly.

---
 adapters/resetdigital/resetdigital.go         | 62 ++++++++++++-------
 .../supplemental/invalid-bid-height.json      |  2 +-
 .../supplemental/invalid-bid-width.json       |  2 +-
 3 files changed, 40 insertions(+), 26 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index e3d7b7419cb..f75ad1b6a9e 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -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
 	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}
 	}
 
-	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))}
+	// }
 
-	var errs []error
-	requestImps := make(map[string]openrtb2.Imp)
-	for _, imp := range request.Imp {
-		requestImps[imp.ID] = imp
+	// Extract the single bid
+	resetDigitalBid := &response.Bids[0]
+
+	// 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)}
 	}
 
-	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) {
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-height.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-height.json
index c197f9cb7da..d1c40ffaba3 100644
--- a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-height.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-height.json
@@ -87,5 +87,5 @@
       "comparison": "literal"
     }
   ],
-  "expectedBidResponses": [{}]
+  "expectedBidResponses": []
 }
diff --git a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-width.json b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-width.json
index bba60c6bdac..8c118bfecd2 100644
--- a/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-width.json
+++ b/adapters/resetdigital/resetdigitaltest/supplemental/invalid-bid-width.json
@@ -87,5 +87,5 @@
       "comparison": "literal"
     }
   ],
-  "expectedBidResponses": [{}]
+  "expectedBidResponses": []
 }

From a96efc8d11ac8736eabc8045cb26b8acffde1110 Mon Sep 17 00:00:00 2001
From: dirk-rd <dirk@resetdigital.co>
Date: Fri, 10 Jan 2025 13:26:23 -0800
Subject: [PATCH 75/75] Uncomment bid count validation.

---
 adapters/resetdigital/resetdigital.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/adapters/resetdigital/resetdigital.go b/adapters/resetdigital/resetdigital.go
index f75ad1b6a9e..78aa6aef40b 100644
--- a/adapters/resetdigital/resetdigital.go
+++ b/adapters/resetdigital/resetdigital.go
@@ -224,9 +224,9 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R
 	}
 
 	// 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))}
-	// }
+	if len(response.Bids) != 1 {
+		return nil, []error{fmt.Errorf("expected exactly one bid in the response, but got %d", len(response.Bids))}
+	}
 
 	// Extract the single bid
 	resetDigitalBid := &response.Bids[0]