Skip to content

Commit

Permalink
Add hasSponsored for verification
Browse files Browse the repository at this point in the history
  • Loading branch information
Robi9 committed Sep 24, 2024
1 parent 3b12bfa commit 45019a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion services/external/weni/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ func (s *service) Call(session flows.Session, params assets.MsgCatalogParam, log
},
}

hasSponsored := false

for _, product := range productList {
if params.SearchType == "default" {
searchResult, trace, err = GetProductListFromSentenX(product, catalog.FacebookCatalogID(), searchThreshold, s.rtConfig)
Expand Down Expand Up @@ -170,6 +172,7 @@ func (s *service) Call(session flows.Session, params assets.MsgCatalogParam, log
productRetailerIDMap = make(map[string]struct{})

if len(searchResultSponsored) > 0 {
hasSponsored = true
allProductsSponsored[0].ProductRetailerIDs = append(allProductsSponsored[0].ProductRetailerIDs, searchResultSponsored+"#"+sellerID)
}

Expand All @@ -192,7 +195,7 @@ func (s *service) Call(session flows.Session, params assets.MsgCatalogParam, log
finalResult := &flows.MsgCatalogCall{}
finalResult.Traces = callResult.Traces
finalResult.ResponseJSON = callResult.ResponseJSON
if len(allProductsSponsored) > 0 {
if hasSponsored {
finalResult.ProductRetailerIDS = allProductsSponsored
}

Expand Down

0 comments on commit 45019a6

Please sign in to comment.