Skip to content

Commit

Permalink
[PAGOPA-2341] fix: included outcome if error occurred on receipt-ok
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-deri committed Nov 15, 2024
1 parent 81c5696 commit 6110128
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
import it.gov.pagopa.wispconverter.repository.model.RPTRequestEntity;
import it.gov.pagopa.wispconverter.repository.model.RTRequestEntity;
import it.gov.pagopa.wispconverter.repository.model.ReceiptDeadLetterEntity;
import it.gov.pagopa.wispconverter.repository.model.enumz.IdempotencyStatusEnum;
import it.gov.pagopa.wispconverter.repository.model.enumz.ReceiptStatusEnum;
import it.gov.pagopa.wispconverter.repository.model.enumz.ReceiptTypeEnum;
import it.gov.pagopa.wispconverter.repository.model.enumz.WorkflowStatus;
import it.gov.pagopa.wispconverter.repository.model.enumz.*;
import it.gov.pagopa.wispconverter.service.mapper.RTMapper;
import it.gov.pagopa.wispconverter.service.model.CachedKeysMapping;
import it.gov.pagopa.wispconverter.service.model.ReceiptDto;
Expand Down Expand Up @@ -708,6 +705,7 @@ private void generateREForFailedSchedulingSentRT(RPTContentDTO rptContent, Strin
MDC.put(Constants.MDC_NOTICE_NUMBER, noticeNumber);
MDC.put(Constants.MDC_PSP_ID, psp);
MDC.put(Constants.MDC_CCP, rptContent.getCcp());
MDC.put(Constants.MDC_OUTCOME, OutcomeEnum.SENDING_RT_FAILED.name());
reService.sendEvent(WorkflowStatus.RT_SEND_SCHEDULING_FAILURE, otherInfo);
MDC.remove(Constants.MDC_IUV);
MDC.remove(Constants.MDC_NOTICE_NUMBER);
Expand All @@ -725,6 +723,7 @@ private void generateREDeadLetter(RPTContentDTO rptContent, String noticeNumber,
MDC.put(Constants.MDC_NOTICE_NUMBER, noticeNumber);
MDC.put(Constants.MDC_PSP_ID, psp);
MDC.put(Constants.MDC_CCP, rptContent.getCcp());
MDC.put(Constants.MDC_OUTCOME, OutcomeEnum.SENDING_RT_FAILED.name());
reService.sendEvent(status, info);
MDC.remove(Constants.MDC_IUV);
MDC.remove(Constants.MDC_NOTICE_NUMBER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ private boolean resendRTToCreditorInstitution(
// Remove receipt from receipt collection
rtRetryComosService.deleteRTRequestEntity(receipt);
} else {
MDC.put(Constants.MDC_OUTCOME, OutcomeEnum.SENDING_RT_FAILED.name());

// Rescheduled due to errors caused by faulty communication with creditor institution
MDC.put(Constants.MDC_OUTCOME, OutcomeEnum.SENDING_RT_FAILED.name());
reScheduleReceiptSend(receipt, receiptId, compositedIdForReceipt);
}

Expand Down Expand Up @@ -277,19 +277,16 @@ private void reScheduleReceiptSend(
serviceBusService.sendMessage(compositedIdForReceipt, schedulingTimeInMinutes);

rtReceiptCosmosService.updateReceiptStatus(ci, iuv, ccp, ReceiptStatusEnum.SCHEDULED);

MDC.put(Constants.MDC_OUTCOME, OutcomeEnum.SENDING_RT_FAILED_RESCHEDULED_SUCCESSFULLY.name());

} catch (Exception e) {

MDC.put(Constants.MDC_OUTCOME, OutcomeEnum.SENDING_RT_FAILED_NOT_RESCHEDULED_DUE_ERROR.name());

rtReceiptCosmosService.updateReceiptStatus(ci, iuv, ccp, ReceiptStatusEnum.NOT_SENT);
}
} else {

MDC.put(Constants.MDC_OUTCOME, OutcomeEnum.SENDING_RT_FAILED_NOT_RESCHEDULED_DUE_MAX_RETRIES.name());

rtReceiptCosmosService.updateReceiptStatus(ci, iuv, ccp, ReceiptStatusEnum.NOT_SENT);
}
}
Expand Down

0 comments on commit 6110128

Please sign in to comment.