add business rules (Black List & Get Affiliation)
This commit is contained in:
parent
d6201f2b36
commit
bef4bddfa6
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
||||
<artifactId>bus-payment-initiation-request</artifactId>
|
||||
<version>1.0-native-quarkus-jdk17</version>
|
||||
<name>bus-payment-initiation-request</name>
|
||||
<description>API Business - Read payment statuses of the file by ID</description>
|
||||
<description>API Business - Create payment single request</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.release>17</maven.compiler.release>
|
||||
|
||||
Binary file not shown.
@ -0,0 +1,112 @@
|
||||
package com.banesco.common.application.helper;
|
||||
|
||||
import com.banesco.common.domain.exception.HttpStatusCodeException;
|
||||
import com.banesco.module.msg_response_header.domain.model.AdditionalStatus;
|
||||
import com.banesco.module.msg_response_header.domain.model.BlackList;
|
||||
import com.banesco.module.msg_response_header.domain.model.BlackListRec;
|
||||
import com.banesco.module.msg_response_header.domain.model.Status;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
public class PartyValidateHelper {
|
||||
|
||||
private PartyValidateHelper() {}
|
||||
|
||||
public static void validateBlackListStatus(
|
||||
BlackList blackList,
|
||||
Status status
|
||||
) {
|
||||
if(!Objects.isNull(blackList)) {
|
||||
BlackListRec blackListRec = blackList.getBlackListRec();
|
||||
|
||||
if(
|
||||
!Objects.isNull(blackListRec) &&
|
||||
!StringUtil.isNullOrEmpty(blackListRec.getBlackListBanesco()) &&
|
||||
!StringUtil.isNullOrEmpty(blackListRec.getBlackListCbn()) &&
|
||||
blackListRec.getBlackListBanesco().equalsIgnoreCase("N") &&
|
||||
blackListRec.getBlackListCbn().equalsIgnoreCase("N")
|
||||
) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PartyValidateHelper.validateStatus(status);
|
||||
}
|
||||
|
||||
public static void validateStatus(Status status) {
|
||||
if(Objects.isNull(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> errors = extractErrorCodes(status);
|
||||
|
||||
if(!errors.isEmpty()) {
|
||||
AdditionalStatus additionalStatus = getFirstAdditionalStatus(status);
|
||||
String error = String.join("-", errors);
|
||||
String desc = (!Objects.isNull(additionalStatus))
|
||||
? additionalStatus.getStatusDesc()
|
||||
: "";
|
||||
|
||||
log.error(
|
||||
"Error asignado desde la lista concatenada de los errores: {} -> {}",
|
||||
error,
|
||||
desc
|
||||
);
|
||||
|
||||
throw HttpStatusCodeException.badRequest(error, desc);
|
||||
} else {
|
||||
log.error(
|
||||
"Error asignado desde el status principal: {} -> {}",
|
||||
status.getStatusCode(),
|
||||
status.getStatusDesc()
|
||||
);
|
||||
|
||||
throw HttpStatusCodeException.internalServer(
|
||||
status.getStatusCode(),
|
||||
status.getStatusDesc()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<String> extractErrorCodes(Status status) {
|
||||
List<String> errors = new ArrayList<>();
|
||||
|
||||
List<AdditionalStatus> additionalStatuses = status.getAdditionalStatus();
|
||||
|
||||
if(Objects.isNull(additionalStatuses) || additionalStatuses.isEmpty()) {
|
||||
return errors;
|
||||
}
|
||||
|
||||
for (AdditionalStatus item: additionalStatuses) {
|
||||
if (
|
||||
!Objects.equals(item.getStatusCode(), "000") &&
|
||||
!errors.contains(item.getStatusCode())
|
||||
) {
|
||||
errors.add(item.getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
private static AdditionalStatus getFirstAdditionalStatus(Status status) {
|
||||
List<AdditionalStatus> additionalStatuses = status.getAdditionalStatus();
|
||||
|
||||
if(Objects.isNull(additionalStatuses) || additionalStatuses.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (AdditionalStatus item: additionalStatuses) {
|
||||
if (!Objects.equals(item.getStatusCode(), "000")) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -36,56 +36,61 @@ public class HttpClientService implements HttpClientUseCase {
|
||||
|
||||
@Override
|
||||
public <T> T execute(HttpRequest request) {
|
||||
return executeInternal(request);
|
||||
return executeRequest(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T, R> Either<T, R> executeEither(HttpRequest request) {
|
||||
return executeEitherInternal(request, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T, R> Either<List<T>, R> executeEitherList(HttpRequest request) {
|
||||
return executeEitherInternal(request, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> ApiResponse<T> executeApiResponse(HttpRequest request) {
|
||||
return executeInternal(request);
|
||||
return executeRequest(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> ApiResponse<List<T>> executeApiResponseList(
|
||||
HttpRequest request
|
||||
) {
|
||||
return executeInternal(request);
|
||||
public <T> ApiResponse<List<T>> executeApiResponseList(HttpRequest request) {
|
||||
return executeRequest(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> ApiPrivateResponse<Either<T, ApiPrivateError>> executeApiPrivateResponse(
|
||||
HttpRequest request
|
||||
) {
|
||||
return executeInternal(request);
|
||||
public <T> ApiPrivateResponse<Either<T, ApiPrivateError>> executeApiPrivateResponse(HttpRequest request) {
|
||||
return executeRequest(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> ApiPrivateResponse<Either<List<T>, ApiPrivateError>> executeApiPrivateResponseList(
|
||||
HttpRequest request
|
||||
) {
|
||||
return executeInternal(request);
|
||||
public <T> ApiPrivateResponse<Either<List<T>, ApiPrivateError>> executeApiPrivateResponseList(HttpRequest request) {
|
||||
return executeRequest(request);
|
||||
}
|
||||
|
||||
private <T> T executeInternal(HttpRequest request) {
|
||||
String finalUrl = buildFinalUrl(request);
|
||||
|
||||
if (request.isLogRequestBody()) {
|
||||
log.info("URL final: {}", finalUrl);
|
||||
|
||||
if (request.getHeaders() != null && !request.getHeaders().isEmpty()) {
|
||||
log.info("Headers: {}", request.getHeaders());
|
||||
}
|
||||
|
||||
if (request.getQueryParams() != null && !request.getQueryParams().isEmpty()) {
|
||||
log.info("Query params: {}", request.getQueryParams());
|
||||
}
|
||||
|
||||
if (request.getBody() != null) {
|
||||
log.info("Body: {}", request.getBody());
|
||||
}
|
||||
}
|
||||
|
||||
private <T, R> Either<T, R> executeEitherInternal(HttpRequest request, boolean isList) {
|
||||
try (Client client = createClient(request.getConnectTimeout(), request.getReadTimeout())) {
|
||||
WebTarget target = client.target(finalUrl);
|
||||
WebTarget target = client.target(buildFinalUrl(request));
|
||||
Invocation.Builder builder = target.request(MediaType.APPLICATION_JSON);
|
||||
|
||||
if (request.getHeaders() != null) {
|
||||
request.getHeaders().forEach(builder::header);
|
||||
}
|
||||
|
||||
Response response = buildRequest(builder, request);
|
||||
return handleEitherResponse(request, response, isList);
|
||||
|
||||
} catch (HttpStatusCodeException | HttpApiResponseException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw handleConnectionError(request, e);
|
||||
}
|
||||
}
|
||||
|
||||
private <T> T executeRequest(HttpRequest request) {
|
||||
try (Client client = createClient(request.getConnectTimeout(), request.getReadTimeout())) {
|
||||
WebTarget target = client.target(buildFinalUrl(request));
|
||||
Invocation.Builder builder = target.request(MediaType.APPLICATION_JSON);
|
||||
|
||||
if (request.getHeaders() != null) {
|
||||
@ -97,14 +102,122 @@ public class HttpClientService implements HttpClientUseCase {
|
||||
} catch (HttpStatusCodeException | HttpApiResponseException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("Error de conexion {}: {}", request.getMethod(), e.getMessage());
|
||||
throw HttpStatusCodeException.serviceUnavailable(
|
||||
"503",
|
||||
"Error de conexion con el servicio externo: " + e.getMessage()
|
||||
);
|
||||
throw handleConnectionError(request, e);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T, R> Either<T, R> handleEitherResponse(HttpRequest request, Response response, boolean isList) {
|
||||
int statusCode = response.getStatus();
|
||||
|
||||
try (response) {
|
||||
String responseBody = response.readEntity(String.class);
|
||||
logResponse(request, statusCode, responseBody);
|
||||
|
||||
if (statusCode >= 200 && statusCode < 300) {
|
||||
Object successData = isList
|
||||
? parseSuccessListResponse(request, responseBody)
|
||||
: parseSuccessResponse(request, responseBody);
|
||||
return Either.left((T) successData);
|
||||
} else {
|
||||
logErrorResponse(request, statusCode, responseBody);
|
||||
R errorData = tryParseErrorResponse(request, responseBody);
|
||||
|
||||
if (errorData != null) {
|
||||
return Either.right(errorData);
|
||||
}
|
||||
|
||||
throw mapHttpStatusToException(statusCode, responseBody);
|
||||
}
|
||||
} catch (HttpStatusCodeException | HttpApiResponseException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw handleProcessingError(request, e);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> T parseSuccessResponse(HttpRequest request, String responseBody) throws JsonProcessingException {
|
||||
Type successType = extractSuccessType(request);
|
||||
|
||||
if (successType != null) {
|
||||
if (successType instanceof Class) {
|
||||
return objectMapper.readValue(responseBody, (Class<T>) successType);
|
||||
} else if (successType instanceof ParameterizedType) {
|
||||
JavaType javaType = objectMapper.getTypeFactory().constructType(successType);
|
||||
return objectMapper.readValue(responseBody, javaType);
|
||||
}
|
||||
}
|
||||
|
||||
if (request.getResponseType() != null && request.getResponseType() != Object.class) {
|
||||
return objectMapper.readValue(responseBody, objectMapper.getTypeFactory().constructType(request.getResponseType()));
|
||||
}
|
||||
|
||||
return (T) objectMapper.readValue(responseBody, Object.class);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> List<T> parseSuccessListResponse(HttpRequest request, String responseBody) throws JsonProcessingException {
|
||||
Type successType = extractSuccessType(request);
|
||||
|
||||
if (
|
||||
successType instanceof ParameterizedType paramType &&
|
||||
paramType.getRawType() == List.class &&
|
||||
paramType.getActualTypeArguments().length > 0
|
||||
) {
|
||||
Type elementType = paramType.getActualTypeArguments()[0];
|
||||
if (elementType instanceof Class) {
|
||||
JavaType javaType = objectMapper.getTypeFactory().constructCollectionType(
|
||||
List.class, (Class<T>) elementType
|
||||
);
|
||||
return objectMapper.readValue(responseBody, javaType);
|
||||
}
|
||||
}
|
||||
|
||||
return objectMapper.readValue(responseBody, List.class);
|
||||
}
|
||||
|
||||
private Type extractSuccessType(HttpRequest request) {
|
||||
if (
|
||||
request.getComplexType() != null &&
|
||||
request.getComplexType() instanceof ParameterizedType paramType &&
|
||||
paramType.getRawType() == Either.class &&
|
||||
paramType.getActualTypeArguments().length > 0
|
||||
) {
|
||||
return paramType.getActualTypeArguments()[0];
|
||||
}
|
||||
|
||||
if (request.getGenericType() != null) {
|
||||
return request.getGenericType();
|
||||
}
|
||||
|
||||
return request.getResponseType();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <R> R tryParseErrorResponse(HttpRequest request, String responseBody) {
|
||||
if (responseBody == null || responseBody.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
if (request.getErrorType() != null) {
|
||||
return (R) objectMapper.readValue(responseBody, request.getErrorType());
|
||||
}
|
||||
|
||||
if (request.getComplexType() != null && request.getComplexType() instanceof ParameterizedType paramType) {
|
||||
Type[] typeArgs = paramType.getActualTypeArguments();
|
||||
if (typeArgs.length >= 2 && typeArgs[1] instanceof Class) {
|
||||
return objectMapper.readValue(responseBody, (Class<R>) typeArgs[1]);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("No se pudo parsear la respuesta como error type: {}", e.getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private String buildFinalUrl(HttpRequest request) {
|
||||
String finalUrl = request.getUrl();
|
||||
|
||||
@ -115,7 +228,11 @@ public class HttpClientService implements HttpClientUseCase {
|
||||
}
|
||||
}
|
||||
|
||||
return appendQueryParams(finalUrl, request.getQueryParams());
|
||||
String url = appendQueryParams(finalUrl, request.getQueryParams());
|
||||
|
||||
log.info("Url Final: {}", url);
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
private String appendQueryParams(String url, Map<String, String> queryParams) {
|
||||
@ -145,12 +262,13 @@ public class HttpClientService implements HttpClientUseCase {
|
||||
return urlBuilder.toString();
|
||||
}
|
||||
|
||||
private Response buildRequest(
|
||||
Invocation.Builder builder,
|
||||
HttpRequest request
|
||||
) {
|
||||
private Response buildRequest(Invocation.Builder builder, HttpRequest request) {
|
||||
log.info("Metodo HTTP: {}", request.getMethod().name());
|
||||
|
||||
if(request.getBody() != null) {
|
||||
log.info("Cuerpo de la Peticion: {}", request.getBody());
|
||||
}
|
||||
|
||||
return switch (request.getMethod()) {
|
||||
case GET -> builder.get();
|
||||
case POST -> builder.post(Entity.entity(request.getBody(), MediaType.APPLICATION_JSON));
|
||||
@ -165,43 +283,26 @@ public class HttpClientService implements HttpClientUseCase {
|
||||
|
||||
private Client createClient(int connectTimeout, int readTimeout) {
|
||||
return ClientBuilder.newBuilder()
|
||||
.connectTimeout(connectTimeout, TimeUnit.MILLISECONDS)
|
||||
.readTimeout(readTimeout, TimeUnit.MILLISECONDS)
|
||||
.build();
|
||||
.connectTimeout(connectTimeout, TimeUnit.MILLISECONDS)
|
||||
.readTimeout(readTimeout, TimeUnit.MILLISECONDS)
|
||||
.build();
|
||||
}
|
||||
|
||||
private <T> T handleResponse(
|
||||
HttpRequest request,
|
||||
Response response
|
||||
) {
|
||||
private <T> T handleResponse(HttpRequest request, Response response) {
|
||||
int statusCode = response.getStatus();
|
||||
log.info("Respuesta {} - Status: {}", request.getMethod(), statusCode);
|
||||
|
||||
try (response) {
|
||||
String responseBody = response.readEntity(String.class);
|
||||
|
||||
if (request.isLogResponseBody()) {
|
||||
log.info("Respuesta Cuerpo: {}", responseBody);
|
||||
}
|
||||
logResponse(request, statusCode, responseBody);
|
||||
|
||||
if (statusCode >= 200 && statusCode < 300) {
|
||||
if (request.getResponseType() == Void.class || request.getResponseType() == void.class) {
|
||||
return null;
|
||||
}
|
||||
|
||||
T result = responseResult(request, responseBody);
|
||||
|
||||
log.debug("Respuesta exitosa {} {}: {}", request.getMethod(), request.getUrl(), result);
|
||||
|
||||
return result;
|
||||
return responseResult(request, responseBody);
|
||||
} else {
|
||||
log.error(
|
||||
"Error HTTP {} {} - Status: {} - Body: {}",
|
||||
request.getMethod(),
|
||||
request.getUrl(),
|
||||
statusCode,
|
||||
responseBody
|
||||
);
|
||||
logErrorResponse(request, statusCode, responseBody);
|
||||
|
||||
if (isApiResponseFormat(responseBody)) {
|
||||
ApiResponse<?> apiResponse = deserializeApiResponse(responseBody, request);
|
||||
@ -213,53 +314,72 @@ public class HttpClientService implements HttpClientUseCase {
|
||||
} catch (HttpStatusCodeException | HttpApiResponseException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error(
|
||||
"Error procesando respuesta {} {}: {}",
|
||||
request.getMethod(),
|
||||
request.getUrl(),
|
||||
e.getMessage()
|
||||
);
|
||||
throw HttpStatusCodeException.internalServer(
|
||||
"500", "Error procesando respuesta del servicio externo: " + e.getMessage()
|
||||
);
|
||||
throw handleProcessingError(request, e);
|
||||
}
|
||||
}
|
||||
|
||||
private <T> T responseResult(
|
||||
HttpRequest request,
|
||||
String responseBody
|
||||
) throws JsonProcessingException {
|
||||
private void logResponse(HttpRequest request, int statusCode, String responseBody) {
|
||||
if (request.isLogResponseBody()) {
|
||||
log.info("Respuesta {} - Status: {}", request.getMethod(), statusCode);
|
||||
log.info("Respuesta Cuerpo: {}", responseBody);
|
||||
}
|
||||
}
|
||||
|
||||
private void logErrorResponse(HttpRequest request, int statusCode, String responseBody) {
|
||||
log.error(
|
||||
"Error HTTP {} {} - Status: {} - Body: {}",
|
||||
request.getMethod(),
|
||||
request.getUrl(),
|
||||
statusCode,
|
||||
responseBody
|
||||
);
|
||||
}
|
||||
|
||||
private HttpStatusCodeException handleConnectionError(HttpRequest request, Exception e) {
|
||||
log.error("Error de conexion {}: {}", request.getMethod(), e.getMessage());
|
||||
|
||||
return HttpStatusCodeException.serviceUnavailable(
|
||||
"503", "Error de conexion con el servicio externo: " + e.getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
private HttpStatusCodeException handleProcessingError(HttpRequest request, Exception e) {
|
||||
log.error(
|
||||
"Error procesando respuesta {} {}: {}",
|
||||
request.getMethod(),
|
||||
request.getUrl(),
|
||||
e.getMessage()
|
||||
);
|
||||
return HttpStatusCodeException.internalServer(
|
||||
"500", "Error procesando respuesta del servicio externo: " + e.getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
private <T> T responseResult(HttpRequest request, String responseBody) throws JsonProcessingException {
|
||||
if (request.isApiPrivateResponse() && request.isEitherResponse()) {
|
||||
return handleApiPrivateResponseWithEither(request, responseBody);
|
||||
}
|
||||
|
||||
T result;
|
||||
|
||||
if (request.getResponseType() == ApiResponse.class) {
|
||||
result = deserializeApiResponse(responseBody, request);
|
||||
return deserializeApiResponse(responseBody, request);
|
||||
} else if (request.getComplexType() != null) {
|
||||
JavaType javaType = objectMapper.getTypeFactory().constructParametricType(
|
||||
request.getResponseType(), objectMapper.getTypeFactory().constructType(request.getComplexType())
|
||||
);
|
||||
result = objectMapper.readValue(responseBody, javaType);
|
||||
return objectMapper.readValue(responseBody, javaType);
|
||||
} else if (request.getGenericType() != null) {
|
||||
JavaType javaType = objectMapper.getTypeFactory().constructParametricType(
|
||||
request.getResponseType(), objectMapper.getTypeFactory().constructType(request.getGenericType())
|
||||
);
|
||||
result = objectMapper.readValue(responseBody, javaType);
|
||||
return objectMapper.readValue(responseBody, javaType);
|
||||
} else {
|
||||
result = objectMapper.readValue(
|
||||
return objectMapper.readValue(
|
||||
responseBody, objectMapper.getTypeFactory().constructType(request.getResponseType())
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private <T> T handleApiPrivateResponseWithEither(
|
||||
HttpRequest request,
|
||||
String responseBody
|
||||
) throws JsonProcessingException {
|
||||
private <T> T handleApiPrivateResponseWithEither(HttpRequest request, String responseBody) throws JsonProcessingException {
|
||||
JsonNode rootNode = objectMapper.readTree(responseBody);
|
||||
String status = rootNode.has("estatus") ? rootNode.get("estatus").asText() : null;
|
||||
String message = rootNode.has("mensaje") ? rootNode.get("mensaje").asText() : null;
|
||||
@ -273,12 +393,7 @@ public class HttpClientService implements HttpClientUseCase {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> T handleSuccessResponse(
|
||||
HttpRequest request,
|
||||
String status,
|
||||
String message,
|
||||
JsonNode detailNode
|
||||
) {
|
||||
private <T> T handleSuccessResponse(HttpRequest request, String status, String message, JsonNode detailNode) {
|
||||
Object successData;
|
||||
|
||||
if (request.isListResponse()) {
|
||||
@ -300,10 +415,7 @@ public class HttpClientService implements HttpClientUseCase {
|
||||
}
|
||||
}
|
||||
|
||||
private Object handleListSuccess(
|
||||
HttpRequest request,
|
||||
JsonNode detailNode
|
||||
) {
|
||||
private Object handleListSuccess(HttpRequest request, JsonNode detailNode) {
|
||||
Class<?> elementType = getElementTypeFromRequest(request);
|
||||
JavaType listType = objectMapper.getTypeFactory().constructCollectionType(List.class, elementType);
|
||||
|
||||
@ -314,10 +426,7 @@ public class HttpClientService implements HttpClientUseCase {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
private Object handleObjectSuccess(
|
||||
HttpRequest request,
|
||||
JsonNode detailNode
|
||||
) {
|
||||
private Object handleObjectSuccess(HttpRequest request, JsonNode detailNode) {
|
||||
Class<?> elementType = getElementTypeFromRequest(request);
|
||||
|
||||
if (detailNode != null && !detailNode.isNull()) {
|
||||
@ -328,11 +437,7 @@ public class HttpClientService implements HttpClientUseCase {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> T handleErrorResponse(
|
||||
String status,
|
||||
String message,
|
||||
JsonNode detailNode
|
||||
) {
|
||||
private <T> T handleErrorResponse(String status, String message, JsonNode detailNode) {
|
||||
ApiPrivateError error = buildApiPrivateError(detailNode, message);
|
||||
ApiPrivateResponse<Either<Object, ApiPrivateError>> response = new ApiPrivateResponse<>();
|
||||
|
||||
@ -343,10 +448,7 @@ public class HttpClientService implements HttpClientUseCase {
|
||||
return (T) response;
|
||||
}
|
||||
|
||||
private ApiPrivateError buildApiPrivateError(
|
||||
JsonNode detailNode,
|
||||
String message
|
||||
) {
|
||||
private ApiPrivateError buildApiPrivateError(JsonNode detailNode, String message) {
|
||||
if (detailNode != null && !detailNode.isNull()) {
|
||||
try {
|
||||
return objectMapper.convertValue(detailNode, ApiPrivateError.class);
|
||||
@ -390,15 +492,11 @@ public class HttpClientService implements HttpClientUseCase {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> T deserializeApiResponse(
|
||||
String responseBody,
|
||||
HttpRequest request
|
||||
) {
|
||||
private <T> T deserializeApiResponse(String responseBody, HttpRequest request) {
|
||||
try {
|
||||
if (request.getGenericType() != null) {
|
||||
JavaType javaType = objectMapper.getTypeFactory().constructParametricType(
|
||||
ApiResponse.class,
|
||||
objectMapper.getTypeFactory().constructType(request.getGenericType())
|
||||
ApiResponse.class, objectMapper.getTypeFactory().constructType(request.getGenericType())
|
||||
);
|
||||
return objectMapper.readValue(responseBody, javaType);
|
||||
} else {
|
||||
@ -432,10 +530,7 @@ public class HttpClientService implements HttpClientUseCase {
|
||||
}
|
||||
}
|
||||
|
||||
private HttpStatusCodeException mapHttpStatusToException(
|
||||
int statusCode,
|
||||
String errorBody
|
||||
) {
|
||||
private HttpStatusCodeException mapHttpStatusToException(int statusCode, String errorBody) {
|
||||
String errorCode = "HTTP_" + statusCode;
|
||||
String defaultMessage = "Error en servicio externo: HTTP " + statusCode;
|
||||
String message = errorBody != null && !errorBody.isEmpty()
|
||||
|
||||
@ -8,6 +8,10 @@ public interface HttpClientUseCase {
|
||||
|
||||
<T> T execute(HttpRequest request);
|
||||
|
||||
<T, R> Either<T, R> executeEither(HttpRequest request);
|
||||
|
||||
<T, R> Either<List<T>, R> executeEitherList(HttpRequest request);
|
||||
|
||||
<T> ApiResponse<T> executeApiResponse(HttpRequest request);
|
||||
|
||||
<T> ApiResponse<List<T>> executeApiResponseList(HttpRequest request);
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
package com.banesco.common.domain.exception;
|
||||
|
||||
public class BusinessException extends BaseApiException {
|
||||
public BusinessException(String errorCode, String message, String fieldPath) {
|
||||
super(errorCode, message, fieldPath, "business");
|
||||
}
|
||||
|
||||
public BusinessException(String errorCode, String fieldPath) {
|
||||
super(errorCode, fieldPath, "business");
|
||||
}
|
||||
}
|
||||
@ -143,6 +143,20 @@ public class HttpRequest {
|
||||
.build();
|
||||
}
|
||||
|
||||
public static <T, R> HttpRequest forDirectResponse(
|
||||
String url,
|
||||
HttpMethod method,
|
||||
Class<T> responseType,
|
||||
Class<R> errorType
|
||||
) {
|
||||
return HttpRequest.builder()
|
||||
.url(url)
|
||||
.method(method)
|
||||
.responseType(responseType)
|
||||
.errorType(errorType)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static <T, U> HttpRequest forGenericResponse(
|
||||
String url,
|
||||
HttpMethod method,
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.banesco.common.infrastructure.config;
|
||||
|
||||
import com.banesco.common.domain.model.DomainConfig;
|
||||
import com.banesco.module.black_list.domain.model.BlackListConfig;
|
||||
import com.banesco.module.get_affiliation.domain.model.GetAffiliationConfig;
|
||||
import com.banesco.module.security_trace.domain.model.SecurityTraceConfig;
|
||||
import com.banesco.module.service_status.domain.model.ServiceStatusConfig;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
@ -26,6 +28,8 @@ public class RestClientConfig {
|
||||
private static final String API_DOMAIN_NAME = "dom-payment-initiation-request";
|
||||
private static final String API_SECURITY_TRACE_NAME = "security-trace";
|
||||
private static final String API_SERVICE_STATUS_NAME = "service-status";
|
||||
private static final String API_BLACK_LIST_NAME = "black-list";
|
||||
private static final String API_GET_AFFILIATION_NAME = "get-affiliation";
|
||||
|
||||
@Inject
|
||||
public RestClientConfig(
|
||||
@ -36,7 +40,7 @@ public class RestClientConfig {
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
public DomainConfig getDomDocserviceFileConfig() {
|
||||
public DomainConfig getDomPaymentRequestConfig() {
|
||||
return getConfig(API_DOMAIN_NAME, DomainConfig.class);
|
||||
}
|
||||
|
||||
@ -48,6 +52,14 @@ public class RestClientConfig {
|
||||
return getConfig(API_SERVICE_STATUS_NAME, ServiceStatusConfig.class);
|
||||
}
|
||||
|
||||
public BlackListConfig getBlackListConfig() {
|
||||
return getConfig(API_BLACK_LIST_NAME, BlackListConfig.class);
|
||||
}
|
||||
|
||||
public GetAffiliationConfig getGetAffiliationConfig() {
|
||||
return getConfig(API_GET_AFFILIATION_NAME, GetAffiliationConfig.class);
|
||||
}
|
||||
|
||||
private <T> T getConfig(
|
||||
String configName,
|
||||
Class<T> configType
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
package com.banesco.module.black_list.application.usecase;
|
||||
|
||||
import com.banesco.common.domain.model.Either;
|
||||
import com.banesco.module.payment_initiation_request.domain.dto.request.PaymentInitiationRequestRequest;
|
||||
|
||||
public interface BlackListUseCase {
|
||||
<T, R> Either<T, R> execute(
|
||||
PaymentInitiationRequestRequest apiRequest,
|
||||
Class<T> responseType,
|
||||
Class<R> errorType
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.banesco.module.black_list.domain.dto.request;
|
||||
|
||||
import com.banesco.module.black_list.domain.model.Customer;
|
||||
import com.banesco.module.msg_request_header.domain.model.MsgRqHdr;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class BlackListRequest {
|
||||
private MsgRqHdr msgRqHdr;
|
||||
private Customer customer;
|
||||
private String domain;
|
||||
private String requestId;
|
||||
private String appId;
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.banesco.module.black_list.domain.dto.response;
|
||||
|
||||
import com.banesco.module.msg_response_header.domain.model.BlackList;
|
||||
import com.banesco.module.msg_response_header.domain.model.MsgRsHdr;
|
||||
import com.banesco.module.msg_response_header.domain.model.Status;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class BlackListResponse {
|
||||
private MsgRsHdr msgRsHdr;
|
||||
private Status status;
|
||||
private BlackList blackList;
|
||||
private String httpStatus;
|
||||
private String blackListBanesco;
|
||||
private String blackListCbn;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.banesco.module.black_list.domain.model;
|
||||
|
||||
import com.banesco.common.domain.model.TimeoutConfig;
|
||||
import com.banesco.module.black_list.domain.dto.request.BlackListRequest;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@RegisterForReflection
|
||||
public class BlackListConfig {
|
||||
private String url;
|
||||
private TimeoutConfig timeout;
|
||||
private BlackListRequest request;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.banesco.module.black_list.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class Customer {
|
||||
private PersonInfo personInfo;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.banesco.module.black_list.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class OtherIdentDoc {
|
||||
private String identSerialNum;
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.banesco.module.black_list.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class PersonInfo {
|
||||
private String nationality;
|
||||
private OtherIdentDoc otherIdentDoc;
|
||||
}
|
||||
@ -0,0 +1,114 @@
|
||||
package com.banesco.module.black_list.infrastructure.client;
|
||||
|
||||
import com.banesco.common.application.usecase.HttpClientUseCase;
|
||||
import com.banesco.common.domain.exception.HttpStatusCodeException;
|
||||
import com.banesco.common.domain.model.Either;
|
||||
import com.banesco.common.domain.model.HttpRequest;
|
||||
import com.banesco.common.infrastructure.config.RestClientConfig;
|
||||
import com.banesco.module.black_list.application.usecase.BlackListUseCase;
|
||||
import com.banesco.module.black_list.domain.dto.request.BlackListRequest;
|
||||
import com.banesco.module.black_list.domain.model.BlackListConfig;
|
||||
import com.banesco.module.black_list.domain.model.Customer;
|
||||
import com.banesco.module.black_list.domain.model.OtherIdentDoc;
|
||||
import com.banesco.module.black_list.domain.model.PersonInfo;
|
||||
import com.banesco.module.msg_request_header.domain.model.MsgRqHdr;
|
||||
import com.banesco.module.payment_initiation_request.domain.dto.request.PaymentInitiationRequestRequest;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@ApplicationScoped
|
||||
public class BlackListClient implements BlackListUseCase {
|
||||
private final HttpClientUseCase httpClientUseCase;
|
||||
private final BlackListConfig blackListConfig;
|
||||
|
||||
@Inject
|
||||
public BlackListClient(
|
||||
HttpClientUseCase httpClientUseCase,
|
||||
RestClientConfig restClientConfig
|
||||
) {
|
||||
this.httpClientUseCase = httpClientUseCase;
|
||||
this.blackListConfig = restClientConfig.getBlackListConfig();
|
||||
log.info("Configuracion cargada para security-trace: {}", blackListConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T, R> Either<T, R> execute(
|
||||
PaymentInitiationRequestRequest apiRequest,
|
||||
Class<T> responseType,
|
||||
Class<R> errorType
|
||||
) {
|
||||
BlackListRequest body = getRequest(apiRequest);
|
||||
HttpRequest request = HttpRequest.forDirectResponse(
|
||||
blackListConfig.getUrl(),
|
||||
HttpRequest.HttpMethod.POST,
|
||||
responseType,
|
||||
errorType
|
||||
)
|
||||
.withBody(body)
|
||||
.withTimeout(
|
||||
blackListConfig.getTimeout().getConnect(),
|
||||
blackListConfig.getTimeout().getResponse()
|
||||
);
|
||||
|
||||
try {
|
||||
Either<T, R> response = httpClientUseCase.executeEither(request);
|
||||
|
||||
log.info(
|
||||
"Solicitud de lista negra exitosa: {}",
|
||||
response.isLeft() && response.getLeft().toString().contains("msgRsHdr=")
|
||||
);
|
||||
|
||||
return response;
|
||||
} catch (HttpStatusCodeException e) {
|
||||
log.error(
|
||||
"Error HTTP ejecutando lista negra: {} - {}",
|
||||
e.getStatusCode(),
|
||||
e.getMessage()
|
||||
);
|
||||
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("Error ejecutando lista negra: {}", e.getMessage());
|
||||
throw HttpStatusCodeException.serviceUnavailable("503");
|
||||
}
|
||||
}
|
||||
|
||||
private BlackListRequest getRequest(
|
||||
PaymentInitiationRequestRequest apiRequest
|
||||
) {
|
||||
String payeeId = apiRequest.getPayeeId();
|
||||
MsgRqHdr msgRqHdr = blackListConfig
|
||||
.getRequest()
|
||||
.getMsgRqHdr()
|
||||
.withOptions(apiRequest.getDevice());
|
||||
|
||||
return BlackListRequest.builder()
|
||||
.msgRqHdr(msgRqHdr)
|
||||
.customer(Customer.builder()
|
||||
.personInfo(PersonInfo.builder()
|
||||
.nationality(payeeId.substring(0, 1).toUpperCase())
|
||||
.otherIdentDoc(OtherIdentDoc.builder()
|
||||
.identSerialNum(getPartyIdNumber(payeeId.substring(1)))
|
||||
.build())
|
||||
.build())
|
||||
.build())
|
||||
.domain(blackListConfig.getRequest().getDomain())
|
||||
.build();
|
||||
}
|
||||
|
||||
private String getPartyIdNumber(String partyId) {
|
||||
if (partyId == null || partyId.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String digits = partyId.replaceAll("\\D", "");
|
||||
|
||||
if (digits.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return digits;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.banesco.module.get_affiliation.application.usecase;
|
||||
|
||||
import com.banesco.common.domain.model.Either;
|
||||
import com.banesco.module.payment_initiation_request.domain.dto.request.PaymentInitiationRequestRequest;
|
||||
|
||||
public interface GetAffiliationUseCase {
|
||||
<T, R> Either<T, R> execute(
|
||||
PaymentInitiationRequestRequest apiRequest,
|
||||
Class<T> responseType,
|
||||
Class<R> errorType
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.banesco.module.get_affiliation.domain.dto.request;
|
||||
|
||||
import com.banesco.module.msg_request_header.domain.model.MsgRqHdr;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class GetAffiliationRequest {
|
||||
private MsgRqHdr msgRqHdr;
|
||||
private String type;
|
||||
private String identSerialNum;
|
||||
private String phone;
|
||||
private String svcType;
|
||||
private String affilType;
|
||||
private String sourceChannelCode;
|
||||
private String domain;
|
||||
private String requestId;
|
||||
private String appId;
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.banesco.module.get_affiliation.domain.dto.response;
|
||||
|
||||
import com.banesco.module.get_affiliation.domain.model.Account;
|
||||
import com.banesco.module.get_affiliation.domain.model.AffiliationSvg;
|
||||
import com.banesco.module.get_affiliation.domain.model.Configuration;
|
||||
import com.banesco.module.get_affiliation.domain.model.Customer;
|
||||
import com.banesco.module.msg_response_header.domain.model.MsgRsHdr;
|
||||
import com.banesco.module.msg_response_header.domain.model.Status;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class GetAffiliationResponse {
|
||||
private MsgRsHdr msgRsHdr;
|
||||
private Status status;
|
||||
private List<AffiliationSvg> affiliationSvc;
|
||||
private Customer customer;
|
||||
private List<Account> account;
|
||||
private List<Configuration> configuration;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.banesco.module.get_affiliation.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class Account {
|
||||
private String acctId;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.banesco.module.get_affiliation.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class AffilStatus {
|
||||
private String affilStatusCode;
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.banesco.module.get_affiliation.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class AffiliationSvg {
|
||||
private String affilType;
|
||||
private String affilDate;
|
||||
private AffilStatus affilStatus;
|
||||
private Service service;
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.banesco.module.get_affiliation.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class Configuration {
|
||||
private String confId;
|
||||
private String confType;
|
||||
private List<Parameter> parameter;
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.banesco.module.get_affiliation.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class CustInfo {
|
||||
private String emailAddr;
|
||||
private List<PhoneNum> phoneNum;
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.banesco.module.get_affiliation.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class Customer {
|
||||
private List<PersonInfo> personInfo;
|
||||
private CustInfo custInfo;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.banesco.module.get_affiliation.domain.model;
|
||||
|
||||
import com.banesco.common.domain.model.TimeoutConfig;
|
||||
import com.banesco.module.get_affiliation.domain.dto.request.GetAffiliationRequest;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@RegisterForReflection
|
||||
public class GetAffiliationConfig {
|
||||
private String url;
|
||||
private TimeoutConfig timeout;
|
||||
private GetAffiliationRequest request;
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.banesco.module.get_affiliation.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class OtherIdentDoc {
|
||||
private String identSerialNum;
|
||||
private String type;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.banesco.module.get_affiliation.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class ParamValue {
|
||||
private String value;
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.banesco.module.get_affiliation.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class Parameter {
|
||||
private String paramName;
|
||||
private ParamValue paramValue;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.banesco.module.get_affiliation.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class PersonInfo {
|
||||
private List<OtherIdentDoc> otherIdentDoc;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.banesco.module.get_affiliation.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class PhoneNum {
|
||||
private String phone;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.banesco.module.get_affiliation.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class Service {
|
||||
private String svcType;
|
||||
}
|
||||
@ -0,0 +1,109 @@
|
||||
package com.banesco.module.get_affiliation.infrastructure.client;
|
||||
|
||||
import com.banesco.common.application.usecase.HttpClientUseCase;
|
||||
import com.banesco.common.domain.exception.HttpStatusCodeException;
|
||||
import com.banesco.common.domain.model.Either;
|
||||
import com.banesco.common.domain.model.HttpRequest;
|
||||
import com.banesco.common.infrastructure.config.RestClientConfig;
|
||||
import com.banesco.module.get_affiliation.application.usecase.GetAffiliationUseCase;
|
||||
import com.banesco.module.get_affiliation.domain.dto.request.GetAffiliationRequest;
|
||||
import com.banesco.module.get_affiliation.domain.model.GetAffiliationConfig;
|
||||
import com.banesco.module.msg_request_header.domain.model.MsgRqHdr;
|
||||
import com.banesco.module.payment_initiation_request.domain.dto.request.PaymentInitiationRequestRequest;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@ApplicationScoped
|
||||
public class GetAffiliationClient implements GetAffiliationUseCase {
|
||||
private final HttpClientUseCase httpClientUseCase;
|
||||
private final GetAffiliationConfig getAffiliationConfig;
|
||||
|
||||
@Inject
|
||||
public GetAffiliationClient(
|
||||
HttpClientUseCase httpClientUseCase,
|
||||
RestClientConfig restClientConfig
|
||||
) {
|
||||
this.httpClientUseCase = httpClientUseCase;
|
||||
this.getAffiliationConfig = restClientConfig.getGetAffiliationConfig();
|
||||
log.info("Configuracion cargada para security-trace: {}", getAffiliationConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T, R> Either<T, R> execute(
|
||||
PaymentInitiationRequestRequest apiRequest,
|
||||
Class<T> responseType,
|
||||
Class<R> errorType
|
||||
) {
|
||||
GetAffiliationRequest body = getRequest(apiRequest);
|
||||
HttpRequest request = HttpRequest.forDirectResponse(
|
||||
getAffiliationConfig.getUrl(),
|
||||
HttpRequest.HttpMethod.POST,
|
||||
responseType,
|
||||
errorType
|
||||
)
|
||||
.withBody(body)
|
||||
.withTimeout(
|
||||
getAffiliationConfig.getTimeout().getConnect(),
|
||||
getAffiliationConfig.getTimeout().getResponse()
|
||||
);
|
||||
|
||||
try {
|
||||
Either<T, R> response = httpClientUseCase.executeEither(request);
|
||||
|
||||
log.info(
|
||||
"Solicitud de consulta de afiliacion exitosa: {}",
|
||||
response.isLeft() && response.getLeft().toString().contains("msgRsHdr=")
|
||||
);
|
||||
|
||||
return response;
|
||||
} catch (HttpStatusCodeException e) {
|
||||
log.error(
|
||||
"Error HTTP ejecutando consulta de afiliacion: {} - {}",
|
||||
e.getStatusCode(),
|
||||
e.getMessage()
|
||||
);
|
||||
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("Error ejecutando consulta de afiliacion: {}", e.getMessage());
|
||||
throw HttpStatusCodeException.serviceUnavailable("503");
|
||||
}
|
||||
}
|
||||
|
||||
private GetAffiliationRequest getRequest(
|
||||
PaymentInitiationRequestRequest apiRequest
|
||||
) {
|
||||
String payeeId = apiRequest.getPayeeId();
|
||||
MsgRqHdr msgRqHdr = getAffiliationConfig
|
||||
.getRequest()
|
||||
.getMsgRqHdr()
|
||||
.withOptions(apiRequest.getDevice());
|
||||
|
||||
return GetAffiliationRequest.builder()
|
||||
.msgRqHdr(msgRqHdr)
|
||||
.type(payeeId.substring(0, 1).toUpperCase())
|
||||
.identSerialNum(getPartyIdNumber(payeeId.substring(1)))
|
||||
.phone(getAffiliationConfig.getRequest().getPhone())
|
||||
.svcType(getAffiliationConfig.getRequest().getSvcType())
|
||||
.affilType(getAffiliationConfig.getRequest().getAffilType())
|
||||
.sourceChannelCode(getAffiliationConfig.getRequest().getSourceChannelCode())
|
||||
.domain(getAffiliationConfig.getRequest().getDomain())
|
||||
.build();
|
||||
}
|
||||
|
||||
private String getPartyIdNumber(String partyId) {
|
||||
if (partyId == null || partyId.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String digits = partyId.replaceAll("\\D", "");
|
||||
|
||||
if (digits.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return digits;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.banesco.module.msg_request_header.domain.model;
|
||||
|
||||
import com.banesco.common.domain.model.Device;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class ApplicantData {
|
||||
private String enterpriseCode;
|
||||
private String privateChannelId;
|
||||
private String ipAddress;
|
||||
private String hostName;
|
||||
private String stadisticId;
|
||||
private String application;
|
||||
private String nationality;
|
||||
private String idDocument;
|
||||
private String rolType;
|
||||
private String planCode;
|
||||
private String channel;
|
||||
|
||||
@JsonIgnore
|
||||
public ApplicantData withOptions(Device device) {
|
||||
this.ipAddress = device.getDeviceIp();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.banesco.module.msg_request_header.domain.model;
|
||||
|
||||
import com.banesco.common.domain.model.Device;
|
||||
import com.banesco.common.infrastructure.context.RequestContext;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class MsgRqHdr {
|
||||
private String messageDate;
|
||||
private String messageTime;
|
||||
private String requestId;
|
||||
private String lastStatusRequest;
|
||||
private String finalStatusRequest;
|
||||
private String resumeId;
|
||||
private String reverseId;
|
||||
private String lineId;
|
||||
private String sourceChannelCode;
|
||||
private String supervisorCode;
|
||||
private String operatorCode;
|
||||
private String requestedOperationType;
|
||||
private List<NetworkTrnInfo> networkTrnInfo;
|
||||
private ApplicantData applicantData;
|
||||
private RecCtrlIn recCtrlIn;
|
||||
private String returnValue;
|
||||
private String messageId;
|
||||
private String priority;
|
||||
private VbProtocol vbProtocol;
|
||||
|
||||
private static DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@JsonIgnore
|
||||
public MsgRqHdr withOptions(Device device) {
|
||||
if(Objects.isNull(this.getApplicantData())) {
|
||||
this.applicantData = ApplicantData.builder()
|
||||
.ipAddress(device.getDeviceIp())
|
||||
.build();
|
||||
} else {
|
||||
this.applicantData = this.applicantData.withOptions(device);
|
||||
}
|
||||
|
||||
String[] dateTime = LocalDateTime.now().format(dateTimeFormatter).split(" ");
|
||||
String date = dateTime[0];
|
||||
String time = dateTime[1];
|
||||
|
||||
this.requestId = RequestContext.getRequestId();
|
||||
this.messageDate = date;
|
||||
this.messageTime = time;
|
||||
|
||||
this.networkTrnInfo = this.networkTrnInfo.stream()
|
||||
.map(info -> (!Objects.isNull(info)) ? info.withOptions(date, time) : null)
|
||||
.toList();
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.banesco.module.msg_request_header.domain.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class NetworkTrnInfo {
|
||||
private String transactionConsecutive;
|
||||
private String registerNumber;
|
||||
private String originatorName;
|
||||
private String operationType;
|
||||
private String transactionType;
|
||||
private String transactionCode;
|
||||
private String transactionDate;
|
||||
private String transactionTime;
|
||||
private String bankId;
|
||||
private String agencyCode;
|
||||
private String channelId;
|
||||
private String channelUserId;
|
||||
private String operationExecIndicator;
|
||||
private String configuredTransactionCode;
|
||||
private String desc;
|
||||
private String userId;
|
||||
private String userType;
|
||||
|
||||
@JsonIgnore
|
||||
public NetworkTrnInfo withOptions(
|
||||
String date,
|
||||
String time
|
||||
) {
|
||||
this.transactionDate = date;
|
||||
this.transactionTime = time;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.banesco.module.msg_request_header.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class RecCtrlIn {
|
||||
private String maxRec;
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.banesco.module.msg_request_header.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class VbProtocol {
|
||||
private Boolean vbProtocolInd;
|
||||
private Boolean transactionInd;
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.banesco.module.msg_response_header.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class AdditionalStatus {
|
||||
private String statusType;
|
||||
private String statusCode;
|
||||
private String statusDesc;
|
||||
private String validationType;
|
||||
private String severity;
|
||||
private String lineNumber;
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.banesco.module.msg_response_header.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class BlackList {
|
||||
private BlackListRec blackListRec;
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.banesco.module.msg_response_header.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class BlackListRec {
|
||||
private String blackListBanesco;
|
||||
private String blackListCbn;
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.banesco.module.msg_response_header.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class MsgRsHdr {
|
||||
private String privateChannelId;
|
||||
private String finalStatusRequest;
|
||||
private String countDataOut;
|
||||
private String headerTypeReg;
|
||||
private String detailTypeReg;
|
||||
private String transactionCode;
|
||||
private String supervisorCode;
|
||||
private String operationType;
|
||||
private String transactionConsecutive;
|
||||
private String detailReg;
|
||||
private List<String> registerNumber;
|
||||
private String transactionType;
|
||||
private String requestId;
|
||||
private String requestedOperationType;
|
||||
private String messageDate;
|
||||
private String transactionTime;
|
||||
private String lastStatusRequest;
|
||||
private String returnValue;
|
||||
private String requestStatus;
|
||||
private String messageTime;
|
||||
private String transacctionDate;
|
||||
private String requestNumber;
|
||||
private String appName;
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.banesco.module.msg_response_header.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class Status {
|
||||
private String statusType;
|
||||
private String statusCode;
|
||||
private String statusDesc;
|
||||
private String applicationName;
|
||||
private int lineNumber;
|
||||
private List<AdditionalStatus> additionalStatus;
|
||||
private String severity;
|
||||
private String statusInd;
|
||||
private String logId;
|
||||
}
|
||||
@ -1,9 +1,15 @@
|
||||
package com.banesco.module.payment_initiation_request.application.service;
|
||||
|
||||
import com.banesco.common.application.helper.MessageHelper;
|
||||
import com.banesco.common.application.helper.PartyValidateHelper;
|
||||
import com.banesco.common.domain.exception.HttpStatusCodeException;
|
||||
import com.banesco.common.domain.model.ApiResponse;
|
||||
import com.banesco.common.domain.model.Either;
|
||||
import com.banesco.common.infrastructure.context.RequestContext;
|
||||
import com.banesco.module.black_list.application.usecase.BlackListUseCase;
|
||||
import com.banesco.module.black_list.domain.dto.response.BlackListResponse;
|
||||
import com.banesco.module.get_affiliation.application.usecase.GetAffiliationUseCase;
|
||||
import com.banesco.module.get_affiliation.domain.dto.response.GetAffiliationResponse;
|
||||
import com.banesco.module.payment_initiation_request.application.usecase.DomainUseCase;
|
||||
import com.banesco.module.payment_initiation_request.application.usecase.PaymentInitiationRequestUseCase;
|
||||
import com.banesco.module.payment_initiation_request.domain.dto.request.PaymentInitiationRequestRequest;
|
||||
@ -26,6 +32,8 @@ public class PaymentInitiationRequestService implements PaymentInitiationRequest
|
||||
|
||||
private final MessageHelper messageHelper;
|
||||
private final ServiceStatusUseCase serviceStatusUseCase;
|
||||
private final BlackListUseCase blackListUseCase;
|
||||
private final GetAffiliationUseCase getAffiliationUseCase;
|
||||
private final SecurityTraceUseCase securityTraceUseCase;
|
||||
private final DomainUseCase domainUseCase;
|
||||
|
||||
@ -33,11 +41,15 @@ public class PaymentInitiationRequestService implements PaymentInitiationRequest
|
||||
public PaymentInitiationRequestService(
|
||||
MessageHelper messageHelper,
|
||||
ServiceStatusUseCase serviceStatusUseCase,
|
||||
BlackListUseCase blackListUseCase,
|
||||
GetAffiliationUseCase getAffiliationUseCase,
|
||||
SecurityTraceUseCase securityTraceUseCase,
|
||||
DomainUseCase domainUseCase
|
||||
) {
|
||||
this.messageHelper = messageHelper;
|
||||
this.serviceStatusUseCase = serviceStatusUseCase;
|
||||
this.blackListUseCase = blackListUseCase;
|
||||
this.getAffiliationUseCase = getAffiliationUseCase;
|
||||
this.securityTraceUseCase = securityTraceUseCase;
|
||||
this.domainUseCase = domainUseCase;
|
||||
}
|
||||
@ -57,6 +69,9 @@ public class PaymentInitiationRequestService implements PaymentInitiationRequest
|
||||
throw HttpStatusCodeException.serviceUnavailable("VRN04");
|
||||
}
|
||||
|
||||
blackList(request);
|
||||
getAffiliation(request);
|
||||
|
||||
ApiResponse<PaymentInitiationRequestResponse> apiResponse = domain(request);
|
||||
|
||||
response = messageHelper.handleSuccess(
|
||||
@ -117,6 +132,69 @@ public class PaymentInitiationRequestService implements PaymentInitiationRequest
|
||||
return isServiceActive;
|
||||
}
|
||||
|
||||
private void blackList(
|
||||
PaymentInitiationRequestRequest request
|
||||
) {
|
||||
log.info("Ejecutando llamada al api de la consulta de la lista negra");
|
||||
|
||||
try {
|
||||
Either<BlackListResponse, BlackListResponse> responseEither = blackListUseCase.execute(
|
||||
request, BlackListResponse.class, BlackListResponse.class
|
||||
);
|
||||
BlackListResponse response = (responseEither.isLeft())
|
||||
? responseEither.getLeft()
|
||||
: responseEither.getRight();
|
||||
|
||||
PartyValidateHelper.validateBlackListStatus(
|
||||
response.getBlackList(),
|
||||
response.getStatus()
|
||||
);
|
||||
} catch (HttpStatusCodeException e) {
|
||||
log.info(
|
||||
"Error HTTP al ejecutar la consulta de la lista negra: {} -> {}",
|
||||
e.getStatusCode(),
|
||||
e.getMessage()
|
||||
);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.info(
|
||||
"Error al ejecutar la consulta de la lista negra: {}",
|
||||
e.getMessage()
|
||||
);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private void getAffiliation(
|
||||
PaymentInitiationRequestRequest request
|
||||
) {
|
||||
log.info("Ejecutando llamada al api de la consulta de afiliacion");
|
||||
|
||||
try {
|
||||
Either<GetAffiliationResponse, GetAffiliationResponse> responseEither = getAffiliationUseCase.execute(
|
||||
request, GetAffiliationResponse.class, GetAffiliationResponse.class
|
||||
);
|
||||
GetAffiliationResponse response = (responseEither.isLeft())
|
||||
? responseEither.getLeft()
|
||||
: responseEither.getRight();
|
||||
|
||||
PartyValidateHelper.validateStatus(response.getStatus());
|
||||
} catch (HttpStatusCodeException e) {
|
||||
log.info(
|
||||
"Error HTTP al ejecutar la consulta de afiliacion: {} -> {}",
|
||||
e.getStatusCode(),
|
||||
e.getMessage()
|
||||
);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.info(
|
||||
"Error al ejecutar la consulta de afiliacion: {}",
|
||||
e.getMessage()
|
||||
);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private void securityTrace(
|
||||
PaymentInitiationRequestRequest request,
|
||||
Response response,
|
||||
|
||||
@ -11,8 +11,8 @@ import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
@Schema(description = "Respuesta de la notificación del cliente")
|
||||
@Schema(description = "Respuesta de la solicitud de pago del cliente")
|
||||
public class PaymentInitiationRequestResponse {
|
||||
@Schema(description = "Instancia de la notificación del cliente")
|
||||
@Schema(description = "Instancia de la solicitud de pago del cliente")
|
||||
private PaymentInitiationTransaction paymentInitiationTransaction;
|
||||
}
|
||||
|
||||
@ -14,10 +14,10 @@ import java.math.BigDecimal;
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class PaymentInitiationTransactionInstanceRecord {
|
||||
private PaymentTransactionType paymentTransactionType;
|
||||
private Payer payerReference;
|
||||
private Payee payeeReference;
|
||||
private BigDecimal amount;
|
||||
private String currencyCode;
|
||||
private String paymentPurpose;
|
||||
private PaymentTransactionType paymentTransactionType; // operationTypeCode
|
||||
private Payer payerReference; // applicantId
|
||||
private Payee payeeReference; // recipientId
|
||||
private BigDecimal amount; // amount
|
||||
private String currencyCode; // currency
|
||||
private String paymentPurpose; // concept
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ public class DomPaymentInitiationRequestClient implements DomainUseCase {
|
||||
RestClientConfig restClientConfig
|
||||
) {
|
||||
this.httpClientUseCase = httpClientUseCase;
|
||||
this.domainConfig = restClientConfig.getDomDocserviceFileConfig();
|
||||
this.domainConfig = restClientConfig.getDomPaymentRequestConfig();
|
||||
log.info("Configuracion cargada para bus-payment-initiation-request: {}", domainConfig);
|
||||
}
|
||||
|
||||
@ -46,8 +46,6 @@ public class DomPaymentInitiationRequestClient implements DomainUseCase {
|
||||
domainConfig.getTimeout().getResponse()
|
||||
);
|
||||
|
||||
log.debug("Request configurado: {}", request);
|
||||
|
||||
try {
|
||||
ApiResponse<T> response = httpClientUseCase.execute(request);
|
||||
|
||||
|
||||
@ -37,8 +37,8 @@ public class PaymentInitiationRequestResource {
|
||||
@POST
|
||||
@Path("/initiate")
|
||||
@Operation(
|
||||
summary = "Proveer informacion de la transaccion",
|
||||
description = "Envía la notificación del cliente"
|
||||
summary = "Genera informacion de la solicitud de pago",
|
||||
description = "Envía la solicitud del pago del cliente"
|
||||
)
|
||||
@APIResponses(value = {
|
||||
@APIResponse(
|
||||
@ -64,7 +64,7 @@ public class PaymentInitiationRequestResource {
|
||||
value = """
|
||||
{
|
||||
"data": {
|
||||
"documentService": {
|
||||
"paymentInitiationTransaction": {
|
||||
"transaction": {
|
||||
"transactionIdentification": {
|
||||
"identifierValue": "1"
|
||||
@ -216,8 +216,7 @@ public class PaymentInitiationRequestResource {
|
||||
})
|
||||
public Response initiate(
|
||||
@RequestBody(
|
||||
description = "Request para la notificación del cliente",
|
||||
required = true,
|
||||
description = "Request de la solicitud del pago del cliente",
|
||||
content = @Content(
|
||||
mediaType = MediaType.APPLICATION_JSON,
|
||||
schema = @Schema(implementation = PaymentInitiationRequestRequest.class),
|
||||
|
||||
@ -59,8 +59,6 @@ public class SecurityTraceClient implements SecurityTraceUseCase {
|
||||
securityTraceConfig.getTimeout().getResponse()
|
||||
);
|
||||
|
||||
log.debug("Request configurado: {}", request);
|
||||
|
||||
try {
|
||||
T response = httpClientUseCase.execute(request);
|
||||
|
||||
|
||||
@ -48,8 +48,6 @@ public class ServiceStatusClient implements ServiceStatusUseCase {
|
||||
serviceStatusConfig.getTimeout().getResponse()
|
||||
);
|
||||
|
||||
log.debug("Request configurado: {}", request);
|
||||
|
||||
try {
|
||||
T response = httpClientUseCase.execute(request);
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user