generated from pagopa/template-java-spring-microservice
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VAS-800] Added new api to retrieved creditor institution business na…
…mes. Do some refactor and added javadoc
- Loading branch information
giomella
committed
Mar 14, 2024
1 parent
7c67403
commit d3d8bf1
Showing
7 changed files
with
290 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...t/gov/pagopa/apiconfig/selfcareintegration/mapper/ConvertPaToCreditorInstitutionInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package it.gov.pagopa.apiconfig.selfcareintegration.mapper; | ||
|
||
import it.gov.pagopa.apiconfig.selfcareintegration.model.creditorinstitution.CreditorInstitutionInfo; | ||
import it.gov.pagopa.apiconfig.starter.entity.Pa; | ||
import org.modelmapper.Converter; | ||
import org.modelmapper.spi.MappingContext; | ||
|
||
import javax.validation.Valid; | ||
|
||
/** | ||
* Converter class, define how to map the {@link Pa} entity into the {@link CreditorInstitutionInfo} model | ||
*/ | ||
public class ConvertPaToCreditorInstitutionInfo implements Converter<Pa, CreditorInstitutionInfo> { | ||
|
||
@Override | ||
public CreditorInstitutionInfo convert(MappingContext<Pa, CreditorInstitutionInfo> context) { | ||
@Valid Pa pa = context.getSource(); | ||
return CreditorInstitutionInfo.builder() | ||
.creditorInstitutionCode(pa.getIdDominio()) | ||
.businessName(pa.getRagioneSociale() != null ? pa.getRagioneSociale() : "") | ||
.build(); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...gopa/apiconfig/selfcareintegration/model/creditorinstitution/CreditorInstitutionInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package it.gov.pagopa.apiconfig.selfcareintegration.model.creditorinstitution; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
|
||
import javax.validation.constraints.NotBlank; | ||
import javax.validation.constraints.NotNull; | ||
|
||
/** | ||
* Model that represent the name and tax code of a creditor institution | ||
*/ | ||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@ToString | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class CreditorInstitutionInfo { | ||
|
||
@JsonProperty("business_name") | ||
@Schema(example = "Comune di Roma", description = "The business name of the creditor institution", requiredMode = Schema.RequiredMode.REQUIRED) | ||
@NotNull | ||
private String businessName; | ||
|
||
@JsonProperty("creditor_institution_code") | ||
@Schema(example = "02438750586", description = "The tax code of the creditor institution", requiredMode = Schema.RequiredMode.REQUIRED) | ||
@NotBlank | ||
private String creditorInstitutionCode; | ||
} |
Oops, something went wrong.