Merge pull request #24 from serg1122/party-type-for-party-suggestion

Добавили параметр 'Type' в запрос подсказок юрлиц
This commit is contained in:
Alex 2024-05-08 19:33:37 +03:00 committed by GitHub
commit 4efbb0bd5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 2 deletions

View File

@ -40,8 +40,9 @@ type (
// RequestParams Request struct
RequestParams struct {
Query string `json:"query"` // user input for suggestion
Count int `json:"count"` // ligmit for results
Type *PartyType `json:"type,omitempty"` // party type for the suggestion (user input)
Query string `json:"query"` // user input for suggestion
Count int `json:"count"` // ligmit for results
Locations []*RequestParamsLocation `json:"locations"`
RestrictValue bool `json:"restrict_value"` // don't show restricts (region) on results

View File

@ -73,6 +73,34 @@ func (s *ApiSuggestIntegrationTest) TestParty() {
s.NotEmpty(res)
}
func (s *ApiSuggestIntegrationTest) TestPartyWithTypePositive() {
api := NewSuggestApi()
// positive: there are some legal entities "сбербанк"
legalParty := suggest.PartyTypeLegal
res, err := api.Party(context.Background(), &suggest.RequestParams{
Query: "сбербанк",
Type: &legalParty,
})
s.NoError(err)
s.NotEmpty(res)
}
func (s *ApiSuggestIntegrationTest) TestPartyWithTypeNegative() {
api := NewSuggestApi()
// there are no one individual entrepreneur "сбербанк"
individualParty := suggest.PartyTypeIndividual
res, err := api.Party(context.Background(), &suggest.RequestParams{
Query: "сбербанк",
Type: &individualParty,
})
s.NoError(err)
s.Empty(res)
}
func (s *ApiSuggestIntegrationTest) TestPartyById() {
api := NewSuggestApi()