Skip to content

Commit

Permalink
revert last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaconsalvi committed Dec 12, 2024
1 parent 84754d3 commit e0613c4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 22 deletions.
2 changes: 0 additions & 2 deletions src/main/java/it/gov/pagopa/rtp/activator/domain/rtp/Rtp.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -44,15 +44,13 @@ public SendRTPServiceImpl(SepaRequestToPayMapper sepaRequestToPayMapper) {
}

@Override
public Mono<Rtp> send(String noticeNumber, BigDecimal amount, String description, LocalDate expiryDate,
String payerId,
public Mono<Rtp> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Rtp> result = sendRTPService.send(noticeNumber, amount, description, expiryDate, payerId,
payeeName,
Mono<Rtp> 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())
Expand All @@ -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));
Expand Down

0 comments on commit e0613c4

Please sign in to comment.