Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Modified encryptedPinBlock to pinBlock #26

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading