diff --git a/src/main/java/it/gov/pagopa/rtp/activator/domain/rtp/Rtp.java b/src/main/java/it/gov/pagopa/rtp/activator/domain/rtp/Rtp.java index 4d15b31..b122f02 100644 --- a/src/main/java/it/gov/pagopa/rtp/activator/domain/rtp/Rtp.java +++ b/src/main/java/it/gov/pagopa/rtp/activator/domain/rtp/Rtp.java @@ -4,8 +4,6 @@ import java.time.LocalDate; import java.time.LocalDateTime; -import lombok.Builder; -@Builder public record Rtp(String noticeNumber, BigDecimal amount, String description, LocalDate expiryDate, String payerId, String payeeName, String payeeId, ResourceID resourceID, LocalDateTime savingDateTime, diff --git a/src/main/java/it/gov/pagopa/rtp/activator/service/rtp/SendRTPServiceImpl.java b/src/main/java/it/gov/pagopa/rtp/activator/service/rtp/SendRTPServiceImpl.java index d9fb994..69bfe8d 100644 --- a/src/main/java/it/gov/pagopa/rtp/activator/service/rtp/SendRTPServiceImpl.java +++ b/src/main/java/it/gov/pagopa/rtp/activator/service/rtp/SendRTPServiceImpl.java @@ -29,7 +29,7 @@ @Service @Slf4j @RegisterReflectionForBinding({ SepaRequestToPayRequestResourceDto.class, - PersonIdentification13EPC25922V30DS02WrapperDto.class, ISODateWrapperDto.class, + PersonIdentification13EPC25922V30DS02WrapperDto.class,ISODateWrapperDto.class, ExternalPersonIdentification1CodeEPC25922V30DS02WrapperDto.class, ExternalServiceLevel1CodeWrapperDto.class, ActiveOrHistoricCurrencyAndAmountEPC25922V30DS02WrapperDto.class, Max35TextWrapperDto.class, OrganisationIdentification29EPC25922V30DS022WrapperDto.class, @@ -44,15 +44,13 @@ public SendRTPServiceImpl(SepaRequestToPayMapper sepaRequestToPayMapper) { } @Override - public Mono send(String noticeNumber, BigDecimal amount, String description, LocalDate expiryDate, - String payerId, + public Mono send(String noticeNumber, BigDecimal amount, String description, LocalDate expiryDate, String payerId, String payeeName, String payeeId, String rtpSpId, String endToEndId, String iban, String payTrxRef, String flgConf) { - Rtp rtp = Rtp.builder().noticeNumber(noticeNumber).amount(amount).description(description).expiryDate(expiryDate) - .payerId(payerId).payeeName(payeeName).payeeId(payeeId).resourceID(ResourceID.createNew()) - .savingDateTime(LocalDateTime.now()).rtpSpId(rtpSpId).endToEndId(endToEndId).iban(iban).payTrxRef(payTrxRef) - .flgConf(flgConf).build(); + Rtp rtp = new Rtp(noticeNumber, amount, description, expiryDate, payerId, payeeName, payeeId, + ResourceID.createNew(), LocalDateTime.now(), rtpSpId, endToEndId, iban, payTrxRef, flgConf); + // save ObjectMapper objectMapper = new ObjectMapper(); objectMapper.enable(SerializationFeature.INDENT_OUTPUT); diff --git a/src/test/java/it/gov/pagopa/rtp/activator/service/rtp/SendRTPServiceTest.java b/src/test/java/it/gov/pagopa/rtp/activator/service/rtp/SendRTPServiceTest.java index 8c9976d..baf34d2 100644 --- a/src/test/java/it/gov/pagopa/rtp/activator/service/rtp/SendRTPServiceTest.java +++ b/src/test/java/it/gov/pagopa/rtp/activator/service/rtp/SendRTPServiceTest.java @@ -53,21 +53,15 @@ void testSend() { String payTrxRef = "payTrxRef"; String flgConf = "flgConf"; - Rtp expectedRtp = Rtp.builder().noticeNumber(noticeNumber).amount(amount).description(description) - .expiryDate(expiryDate) - .payerId(payerId).payeeName(payeeName).payeeId(payeeId) - .resourceID(ResourceID.createNew()) - .savingDateTime(LocalDateTime.now()).rtpSpId("rtpSpId").endToEndId(endToEndId) - .iban(iban).payTrxRef(payTrxRef) - .flgConf(flgConf).build(); + Rtp expectedRtp = new Rtp(noticeNumber, amount, description, expiryDate, payerId, payeeName, payeeId, + ResourceID.createNew(), LocalDateTime.now(),"rtpSpId", endToEndId, iban, payTrxRef, flgConf); + SepaRequestToPayRequestResourceDto mockSepaRequestToPayRequestResource = new SepaRequestToPayRequestResourceDto( URI.create("http://callback.url")); - when(sepaRequestToPayMapper.toRequestToPay(any(Rtp.class))) - .thenReturn(mockSepaRequestToPayRequestResource); + when(sepaRequestToPayMapper.toRequestToPay(any(Rtp.class))).thenReturn(mockSepaRequestToPayRequestResource); - Mono result = sendRTPService.send(noticeNumber, amount, description, expiryDate, payerId, - payeeName, + Mono result = sendRTPService.send(noticeNumber, amount, description, expiryDate, payerId, payeeName, payeeId, rtpSpId, endToEndId, iban, payTrxRef, flgConf); StepVerifier.create(result) .expectNextMatches(rtp -> rtp.noticeNumber().equals(expectedRtp.noticeNumber()) @@ -79,8 +73,7 @@ void testSend() { && rtp.payeeId().equals(expectedRtp.payeeId()) && rtp.rtpSpId().equals(expectedRtp.rtpSpId()) && rtp.endToEndId().equals(expectedRtp.endToEndId()) - && rtp.iban().equals(expectedRtp.iban()) - && rtp.payTrxRef().equals(expectedRtp.payTrxRef()) + && rtp.iban().equals(expectedRtp.iban()) && rtp.payTrxRef().equals(expectedRtp.payTrxRef()) && rtp.flgConf().equals(expectedRtp.flgConf())) .verifyComplete(); verify(sepaRequestToPayMapper, times(1)).toRequestToPay(any(Rtp.class));