Skip to content

Commit

Permalink
feat: [SRTP-127] add send RTP controller (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
TommasoLencioni authored Dec 4, 2024
1 parent 1c61402 commit e74e165
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package it.gov.pagopa.rtp.activator.controller;

import static it.gov.pagopa.rtp.activator.utils.Authorizations.verifySubjectRequest;

import it.gov.pagopa.rtp.activator.configuration.ActivationPropertiesConfig;
import it.gov.pagopa.rtp.activator.controller.generated.send.RtpsApi;
import it.gov.pagopa.rtp.activator.model.generated.send.CreateRtpDto;
import it.gov.pagopa.rtp.activator.service.ActivationPayerService;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

@RestController
@Validated
public class SendAPIControllerImpl implements RtpsApi {

private final ActivationPayerService activationPayerService;

private final ActivationPropertiesConfig activationPropertiesConfig;

public SendAPIControllerImpl(ActivationPayerService activationPayerService,
ActivationPropertiesConfig activationPropertiesConfig) {
this.activationPayerService = activationPayerService;
this.activationPropertiesConfig = activationPropertiesConfig;
}

@Override
@PreAuthorize("hasRole('write_rtp_send')")
public Mono<ResponseEntity<Void>> createRtp(Mono<CreateRtpDto> createRtpDto,
ServerWebExchange exchange
) {
return verifySubjectRequest(createRtpDto, CreateRtpDto::getPayerId)
.thenReturn(ResponseEntity.status(201).build());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package it.gov.pagopa.rtp.activator.service;

import it.gov.pagopa.rtp.activator.model.generated.epc.SepaRequestToPayRequestResourceDto;
import it.gov.pagopa.rtp.activator.model.generated.send.CreateRtpDto;
import org.springframework.stereotype.Service;

@Service
public class SendRTPService {

public SepaRequestToPayRequestResourceDto send (CreateRtpDto createRtpDto){
return new SepaRequestToPayRequestResourceDto();
}

}

0 comments on commit e74e165

Please sign in to comment.