Skip to content

Commit

Permalink
Merge pull request #32 from pagopa/fix-delete-receipt-timer
Browse files Browse the repository at this point in the history
fix: Update deleteTimer RequestParam
  • Loading branch information
cap-ang authored Jun 25, 2024
2 parents 783e64a + eb60e34 commit b6861a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import it.gov.pagopa.wispconverter.controller.model.ReceiptTimerRequest;
import it.gov.pagopa.wispconverter.service.ReceiptTimerService;
import it.gov.pagopa.wispconverter.util.Trace;
import java.util.Arrays;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -53,9 +54,9 @@ public void createTimer(@RequestBody ReceiptTimerRequest request) {
produces = MediaType.APPLICATION_JSON_VALUE
)
@Trace(businessProcess = BP_TIMER_DELETE, reEnabled = true)
public void deleteTimer(@RequestParam List<String> paymentTokens) {
log.info("Delete Timer arrived: " + paymentTokens);
receiptTimerService.cancelScheduledMessage(paymentTokens);

public void deleteTimer(@RequestParam() String paymentTokens) {
List<String> tokens = Arrays.asList(paymentTokens.split(","));
log.info("Delete Timer arrived: " + tokens);
receiptTimerService.cancelScheduledMessage(tokens);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void testDeleteTimer() throws Exception {
List<String> paymentTokens = List.of("token1", "token2");

mockMvc.perform(delete("/receipt/timer")
.param("paymentTokens", "token1", "token2")
.param("paymentTokens", "token1,token2")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());

Expand All @@ -135,7 +135,7 @@ public void testDeleteTimerServiceException() throws Exception {
doThrow(new RuntimeException("Service exception")).when(receiptTimerService).cancelScheduledMessage(Mockito.eq(paymentTokens));

mockMvc.perform(delete("/receipt/timer")
.param("paymentTokens", "token1", "token2")
.param("paymentTokens", "token1,token2")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isInternalServerError());

Expand Down

0 comments on commit b6861a0

Please sign in to comment.