Skip to content

Commit

Permalink
[PAGOPA-2206] fix: replaced NAV with IUV in idempotency key generation
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-deri committed Sep 30, 2024
1 parent ab634e6 commit eb9c0c9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public class IdempotencyService {
@Value("${wisp-converter.idempotency.lock-validity-in-minutes}")
private Integer lockValidityInMinutes;

public static String generateIdempotencyKeyId(String sessionId, String noticeNumber, String domainId) {
return String.format("%s_%s_%s", sessionId, noticeNumber, domainId);
public static String generateIdempotencyKeyId(String sessionId, String iuv, String domainId) {
return String.format("%s_%s_%s", sessionId, iuv, domainId);
}

public boolean isIdempotencyKeyProcessable(String idempotencyKey, ReceiptTypeEnum receiptType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ From station identifier (the common one defined, not the payment reference), ret
InetSocketAddress proxyAddress = CommonUtility.constructProxyAddress(uri, station, apimPath);

// idempotency key creation to check if the rt has already been sent
String idempotencyKey = IdempotencyService.generateIdempotencyKeyId(sessionData.getCommonFields().getSessionId(), noticeNumber, rpt.getRpt().getDomain().getDomainId());
String idempotencyKey = IdempotencyService.generateIdempotencyKeyId(sessionData.getCommonFields().getSessionId(), iuv, rpt.getRpt().getDomain().getDomainId());

// send to creditor institution only if another receipt wasn't already sent
ReceiptTypeEnum receiptType = mustSendNegativeRT ? ReceiptTypeEnum.KO : ReceiptTypeEnum.OK;
Expand Down Expand Up @@ -731,7 +731,7 @@ public void sendRTKoFromSessionId(String sessionId, InternalStepStatus internalS
String domainId = rpt.getRpt().getDomain().getDomainId();

// idempotency key creation to check if the rt has already been sent
String idempotencyKey = IdempotencyService.generateIdempotencyKeyId(sessionDataDTO.getCommonFields().getSessionId(), null, domainId);
String idempotencyKey = IdempotencyService.generateIdempotencyKeyId(sessionDataDTO.getCommonFields().getSessionId(), rpt.getIuv(), domainId);
idempotencyService.lockIdempotencyKey(idempotencyKey, ReceiptTypeEnum.KO);

String rtRawPayload = generateKoRtFromSessionData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private RTRequestEntity getStoredReceipt(int retries, String rawtype, String url
.receiptType(type)
.url(url)
.headers(List.of("soapaction:paaInviaRT"))
.idempotencyKey("uuid_nav_idDominio")
.idempotencyKey("uuid_iuv_idDominio")
.build();
}

Expand Down

0 comments on commit eb9c0c9

Please sign in to comment.