Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PAGOPA-1800] fix: Update Stamp mapping #105

Merged
merged 10 commits into from
Jun 6, 2024
1 change: 1 addition & 0 deletions .github/workflows/deploy_with_github_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
container_app_environment_name: ${{ vars.CONTAINER_APP_ENVIRONMENT_NAME }}
resource_group_name: ${{ vars.CONTAINER_APP_ENVIRONMENT_RESOURCE_GROUP_NAME }} # RG of the runner
pat_token: ${{ secrets.BOT_TOKEN_GITHUB }}
self_hosted_runner_image_tag: "latest"

deploy:
needs: [ create_runner ]
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<optional>true</optional>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
package it.gov.pagopa.payments.mapper;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import it.gov.pagopa.payments.model.Stamp;
import it.gov.pagopa.payments.model.partner.CtRichiestaMarcaDaBollo;
import java.util.Collections;
import javax.validation.Valid;
import org.modelmapper.Converter;
import org.modelmapper.MappingException;
import org.modelmapper.spi.ErrorMessage;
import org.modelmapper.spi.MappingContext;

public class ConvertMarcaDaBolloToCtRichiestaMarcaDaBollo
implements Converter<Stamp, CtRichiestaMarcaDaBollo> {

@Override
public CtRichiestaMarcaDaBollo convert(
MappingContext<Stamp, CtRichiestaMarcaDaBollo> context) throws MappingException {
ObjectMapper mapper = new ObjectMapper();
public CtRichiestaMarcaDaBollo convert(MappingContext<Stamp, CtRichiestaMarcaDaBollo> context)
throws MappingException {
@Valid Stamp source = context.getSource();
CtRichiestaMarcaDaBollo ctRichiestaMarcaDaBollo = new CtRichiestaMarcaDaBollo();
try {
ctRichiestaMarcaDaBollo.setTipoBollo(source.getStampType());
ctRichiestaMarcaDaBollo.setProvinciaResidenza(source.getProvincialResidence());
ctRichiestaMarcaDaBollo.setHashDocumento(mapper.writeValueAsBytes(source.getHashDocument()));
} catch (JsonProcessingException e) {
throw new MappingException(Collections.singletonList(new ErrorMessage(e.getMessage())));
}
ctRichiestaMarcaDaBollo.setTipoBollo(source.getStampType());
ctRichiestaMarcaDaBollo.setProvinciaResidenza(source.getProvincialResidence());
ctRichiestaMarcaDaBollo.setHashDocumento(source.getHashDocument().getBytes());
return ctRichiestaMarcaDaBollo;
}
}
Loading
Loading