Skip to content

Commit

Permalink
fix: Modified encryptedPinBlock to pinBlock (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
RiccardoGiuliani authored Feb 9, 2024
1 parent 66c02dd commit ff72454
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
@Builder
public class PinBlockDTO {

@NotNull(message = "[" + ErrorCode.ERROR_ENCRYPTEDPINBLOCK_MUST_NOT_BE_NULL + "] encryptedPinBlock must not be null")
private String encryptedPinBlock;
@NotNull(message = "[" + ErrorCode.ERROR_ENCRYPTEDPINBLOCK_MUST_NOT_BE_NULL + "] pinBlock must not be null")
private String pinBlock;

@NotNull(message = "[" + ErrorCode.ERROR_ENCRYPTEDKEY_MUST_NOT_BE_NULL + "] encryptedKey must not be null")
private String encryptedKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import it.pagopa.swclient.mil.idpay.dao.IdpayTransactionEntity;
import it.pagopa.swclient.mil.idpay.dao.IdpayTransactionRepository;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.BadRequestException;
import jakarta.ws.rs.InternalServerErrorException;
import jakarta.ws.rs.NotFoundException;
Expand Down Expand Up @@ -56,14 +55,11 @@ public class TransactionsService {

private final SimpleDateFormat lastUpdateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");

@Inject
IdpayTransactionRepository idpayTransactionRepository;
private final IdpayTransactionRepository idpayTransactionRepository;

@Inject
EncryptUtil encryptUtil;
private final EncryptUtil encryptUtil;

@Inject
AzureKeyVaultService azureKeyVaultService;
private final AzureKeyVaultService azureKeyVaultService;

@RestClient
AzureADRestClient azureADRestClient;
Expand All @@ -74,8 +70,7 @@ public class TransactionsService {
@RestClient
IpzsRestClient ipzsRestClient;

@Inject
IdPayRestService idPayRestService;
private final IdPayRestService idPayRestService;

private static final String BEARER = "Bearer ";

Expand All @@ -90,6 +85,14 @@ public class TransactionsService {
@ConfigProperty(name = "azure-auth-api.identity")
String identity;

public TransactionsService(IdpayTransactionRepository idpayTransactionRepository, EncryptUtil encryptUtil,
AzureKeyVaultService azureKeyVaultService, IdPayRestService idPayRestService) {
this.idpayTransactionRepository = idpayTransactionRepository;
this.encryptUtil = encryptUtil;
this.azureKeyVaultService = azureKeyVaultService;
this.idPayRestService = idPayRestService;
}

public Uni<InitiativesResponse> getInitiatives(CommonHeader headers) {

Log.debugf("TransactionsService -> getInitiatives - Input parameters: %s", headers);
Expand Down Expand Up @@ -533,7 +536,7 @@ public Uni<Response> authorizeTransaction(CommonHeader headers, AuthorizeTransac
String encryptedSessionKey = encryptUtil.encryptSessionKeyForIdpay(publicKeyIDPay, unwrappedKey.getValue());

PinBlockDTO pinBlock = PinBlockDTO.builder()
.encryptedPinBlock(authorizeTransaction.getAuthCodeBlockData().getAuthCodeBlock())
.pinBlock(authorizeTransaction.getAuthCodeBlockData().getAuthCodeBlock())
.encryptedKey(encryptedSessionKey)
.build();

Expand Down

0 comments on commit ff72454

Please sign in to comment.