Skip to content

Commit

Permalink
Fix find by tax code (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-putzu authored Apr 24, 2024
1 parent 346aff6 commit eb3668b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/src/main/resources/swagger/api-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@
"/insurance-companies/origin/{originId}" : {
"get" : {
"tags" : [ "insurance-companies" ],
"summary" : "Search insurance company by its taxCode",
"summary" : "Search insurance company by its IVASS code",
"description" : "Returns only one insurance company.",
"operationId" : "searchByOriginIdUsingGET",
"parameters" : [ {
Expand Down Expand Up @@ -1051,6 +1051,7 @@
}
}
},
"deprecated" : true,
"security" : [ {
"bearerAuth" : [ "global" ]
} ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public Document apply(InsuranceCompany company) {
doc.add(new StringField(ORIGIN_ID.toString(), company.getOriginId(), Field.Store.YES));
doc.add(new SortedDocValuesField(DESCRIPTION.toString(), new BytesRef(company.getDescription())));
doc.add(new TextField(DESCRIPTION.toString(), company.getDescription(), Field.Store.YES));
doc.add(new StoredField(TAX_CODE.toString(), company.getTaxCode()));
doc.add(new StringField(TAX_CODE.toString(), company.getTaxCode(), Field.Store.YES));
doc.add(new StoredField(DIGITAL_ADDRESS.toString(), company.getDigitalAddress()));
doc.add(new StoredField(ADDRESS.toString(), String.valueOf(company.getAddress())));
doc.add(new StoredField(REGISTER_TYPE.toString(), String.valueOf(company.getRegisterType())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class IvassServiceImpl implements IvassService {
public InsuranceCompany findByTaxCode(String taxId) {
log.trace("findByTaxCode start");
log.debug("findByTaxCode parameter = {}", taxId.toUpperCase());
final List<InsuranceCompany> companies = indexSearchService.findById(InsuranceCompany.Field.ID, taxId.toUpperCase());
final List<InsuranceCompany> companies = indexSearchService.findById(InsuranceCompany.Field.TAX_CODE, taxId.toUpperCase());
if (companies.isEmpty()) {
throw new ResourceNotFoundException();
} else if (companies.size() > 1) {
Expand Down

0 comments on commit eb3668b

Please sign in to comment.