Add Success Mock by default
This commit is contained in:
parent
67c046ef9b
commit
7e0c437a3e
45
pom.xml
45
pom.xml
@ -12,6 +12,7 @@
|
||||
<compiler-plugin.version>3.14.1</compiler-plugin.version>
|
||||
<compiler-plugin-surefire.version>3.5.4</compiler-plugin-surefire.version>
|
||||
<compiler-plugin-failsafe.version>3.5.4</compiler-plugin-failsafe.version>
|
||||
<compiler-plugin-openshift.version>1.18.2</compiler-plugin-openshift.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
|
||||
@ -29,6 +30,13 @@
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${quarkus.platform.group-id}</groupId>
|
||||
<artifactId>quarkus-camel-bom</artifactId>
|
||||
<version>${quarkus.platform.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
@ -76,6 +84,21 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.jkube</groupId>
|
||||
<artifactId>openshift-maven-plugin</artifactId>
|
||||
<version>${compiler-plugin-openshift.version}</version>
|
||||
<configuration>
|
||||
<resources>
|
||||
<volumeMounts>
|
||||
<volumeMount>
|
||||
<name>maven-volumen</name>
|
||||
<mountPath>/root/.m2</mountPath>
|
||||
</volumeMount>
|
||||
</volumeMounts>
|
||||
</resources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>${quarkus.platform.group-id}</groupId>
|
||||
<artifactId>quarkus-maven-plugin</artifactId>
|
||||
@ -86,6 +109,7 @@
|
||||
<goals>
|
||||
<goal>build</goal>
|
||||
<goal>generate-code</goal>
|
||||
<goal>generate-code-tests</goal>
|
||||
<goal>native-image-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
@ -97,13 +121,6 @@
|
||||
<version>${compiler-plugin.version}</version>
|
||||
<configuration>
|
||||
<parameters>true</parameters>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@ -149,9 +166,21 @@
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<quarkus.package.jar.enabled>false</quarkus.package.jar.enabled>
|
||||
<skipITs>false</skipITs>
|
||||
<quarkus.package.type>native</quarkus.package.type>
|
||||
<quarkus.native.enabled>true</quarkus.native.enabled>
|
||||
</properties>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<excludes>
|
||||
<exclude>application-dev.yaml</exclude>
|
||||
<exclude>application-local.yaml</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
@ -10,11 +10,11 @@
|
||||
#
|
||||
# Then, build the image with:
|
||||
#
|
||||
# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/rec-update-card-status .
|
||||
# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/rec-legal-customer-product-directory .
|
||||
#
|
||||
# Then run the container using:
|
||||
#
|
||||
# docker run -i --rm -p 8080:8080 quarkus/rec-update-card-transaction-switch
|
||||
# docker run -i --rm -p 8080:8080 quarkus/rec-legal-customer-product-directory
|
||||
#
|
||||
###
|
||||
FROM quay.io/quarkus/quarkus-micro-image:2.0
|
||||
|
||||
@ -83,25 +83,6 @@ public class ErrorResponseHelper {
|
||||
.build();
|
||||
}
|
||||
|
||||
public StatusResponse handleGenericException(BaseApiException exception) {
|
||||
ErrorMapping mapping = errorMappings.getOrDefault(
|
||||
exception.getErrorCode(),
|
||||
errorMappings.getOrDefault(ERROR_DEFAULT, createDefaultMapping())
|
||||
);
|
||||
StatusResponse status = createErrorResponse(
|
||||
mapping, null
|
||||
);
|
||||
|
||||
log.error(
|
||||
"[{}] Error {} -> {}",
|
||||
exception.getExceptionType(),
|
||||
exception.getErrorCode(),
|
||||
status.getMessage()
|
||||
);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
public <T> ApiResponse<T> buildServiceUnavailableResponse() {
|
||||
return new ApiResponse<>(null, createSuccessResponse("503"));
|
||||
}
|
||||
@ -123,7 +104,7 @@ public class ErrorResponseHelper {
|
||||
|
||||
|
||||
log.error(
|
||||
"[{}] Error {} -> {}",
|
||||
"[{}] Message {} -> {}",
|
||||
exception.getExceptionType(),
|
||||
exception.getErrorCode(),
|
||||
status.getMessage()
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
package com.banesco.common.domain.exception;
|
||||
|
||||
public class SuccessException extends BaseApiException {
|
||||
public SuccessException(String code, String message, String fieldPath) {
|
||||
super(code, message, fieldPath, "ok");
|
||||
}
|
||||
|
||||
public SuccessException(String code, String fieldPath) {
|
||||
super(code, fieldPath, "ok");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.banesco.common.domain.model;
|
||||
|
||||
public enum CurrencyType {
|
||||
BASE,
|
||||
REPORTING,
|
||||
SECONDARY,
|
||||
TRANSFER
|
||||
}
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
package com.banesco.common.domain.model
|
||||
|
||||
enum class CurrencyType {
|
||||
BASE,
|
||||
REPORTING,
|
||||
SECONDARY,
|
||||
TRANSFER
|
||||
}
|
||||
@ -1,12 +1,14 @@
|
||||
package com.banesco.common.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class Identifier {
|
||||
private String identifierValue;
|
||||
private String issuingAuthority;
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
package com.banesco.common.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class Name {
|
||||
private String fullName;
|
||||
}
|
||||
|
||||
@ -1,14 +1,16 @@
|
||||
package com.banesco.module.account.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class Account {
|
||||
private AccountStatus accountStatus;
|
||||
private List<AccountIdentification> accountIdentification;
|
||||
|
||||
@ -1,14 +1,16 @@
|
||||
package com.banesco.module.account.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class AccountBalance {
|
||||
private BigDecimal balanceAmount;
|
||||
private String balanceType;
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
package com.banesco.module.account.domain.model;
|
||||
|
||||
import com.banesco.common.domain.model.CurrencyType;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class AccountCurrency {
|
||||
private String currencyCode;
|
||||
private CurrencyType currencyType;
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
package com.banesco.module.account.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class AccountDateTime {
|
||||
private String dateType;
|
||||
private String date;
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
package com.banesco.module.account.domain.model;
|
||||
|
||||
import com.banesco.common.domain.model.Identifier;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class AccountIdentification {
|
||||
private String accountIdentificationType;
|
||||
private Identifier accountIdentification;
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
package com.banesco.module.account.domain.model;
|
||||
|
||||
import com.banesco.module.party.domain.model.Party;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class AccountInvolvement {
|
||||
private String accountInvolvementType;
|
||||
private Party partyReference;
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
package com.banesco.module.account.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class AccountStatus {
|
||||
private String status;
|
||||
private String statusType;
|
||||
|
||||
@ -4,15 +4,25 @@ import com.banesco.common.application.helper.ErrorResponseHelper;
|
||||
import com.banesco.common.application.helper.RequestValidatorHelper;
|
||||
import com.banesco.common.domain.exception.BaseApiException;
|
||||
import com.banesco.common.domain.exception.ServiceUnavailableException;
|
||||
import com.banesco.common.domain.model.ApiResponse;
|
||||
import com.banesco.common.domain.model.*;
|
||||
import com.banesco.module.account.domain.model.*;
|
||||
import com.banesco.module.legal_customer_product_directory.application.usecase.BusinessUseCase;
|
||||
import com.banesco.module.legal_customer_product_directory.application.usecase.LegalCustomerProductDirectoryUseCase;
|
||||
import com.banesco.module.legal_customer_product_directory.domain.dto.request.LegalCustomerProductDirectoryRequest;
|
||||
import com.banesco.module.legal_customer_product_directory.domain.dto.response.LegalCustomerProductDirectoryResponse;
|
||||
import com.banesco.module.legal_customer_product_directory.domain.model.CustomerProductAndServiceDirectory;
|
||||
import com.banesco.module.party.domain.model.Party;
|
||||
import com.banesco.module.party.domain.model.PartyIdentification;
|
||||
import com.banesco.module.party.domain.model.PartyIdentificationType;
|
||||
import com.banesco.module.party.domain.model.PartyType;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@ApplicationScoped
|
||||
public class LegalCustomerProductDirectoryService implements LegalCustomerProductDirectoryUseCase {
|
||||
@ -41,29 +51,159 @@ public class LegalCustomerProductDirectoryService implements LegalCustomerProduc
|
||||
try {
|
||||
return business(request);
|
||||
} catch (BaseApiException e) {
|
||||
if(Objects.equals(e.getErrorCode(), "200")) {
|
||||
return createSuccessMock();
|
||||
}
|
||||
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new ServiceUnavailableException("503", e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
private ApiResponse<LegalCustomerProductDirectoryResponse> business(
|
||||
LegalCustomerProductDirectoryRequest request
|
||||
) {
|
||||
log.info("Calling business service for client: {}", request.getCustomerIbsNumber());
|
||||
|
||||
return businessUseCase.execute(
|
||||
request.getCustomerIbsNumber(),
|
||||
request.toBusinessRequest(),
|
||||
request.toBusinessHeaders(),
|
||||
LegalCustomerProductDirectoryResponse.class
|
||||
);
|
||||
}
|
||||
|
||||
private void validate(
|
||||
LegalCustomerProductDirectoryRequest request
|
||||
) {
|
||||
requestValidatorHelper.validateRequired(request);
|
||||
requestValidatorHelper.validateFieldValues(request);
|
||||
}
|
||||
|
||||
private ApiResponse<LegalCustomerProductDirectoryResponse> business(
|
||||
LegalCustomerProductDirectoryRequest request
|
||||
) {
|
||||
log.info("Calling business service for client: {}", request.getCustomerIbsNumber());
|
||||
|
||||
return businessUseCase.execute(
|
||||
true,
|
||||
request.getCustomerIbsNumber(),
|
||||
request.toBusinessRequest(),
|
||||
request.toBusinessHeaders(),
|
||||
LegalCustomerProductDirectoryResponse.class
|
||||
);
|
||||
}
|
||||
|
||||
private ApiResponse<LegalCustomerProductDirectoryResponse> createSuccessMock() {
|
||||
StatusResponse statusResponse = StatusResponse.builder()
|
||||
.statusCode("200")
|
||||
.message("Operación exitosa")
|
||||
.build();
|
||||
|
||||
return new ApiResponse<>(
|
||||
LegalCustomerProductDirectoryResponse.builder()
|
||||
.customerProductAndServiceDirectory(CustomerProductAndServiceDirectory.builder()
|
||||
.party(Party.builder()
|
||||
.partyName(List.of(
|
||||
Name.builder()
|
||||
.fullName("TASCA RESTAURANT GOOD WORLD CEN, C.A.")
|
||||
.build()
|
||||
))
|
||||
.partyType(PartyType.ORGANISATION)
|
||||
.partyDateTime(List.of())
|
||||
.partyIdentification(List.of(
|
||||
PartyIdentification.builder()
|
||||
.partyIdentificationType(PartyIdentificationType.TAX_IDENTIFICATION_NUMBER)
|
||||
.partyIdentification(Identifier.builder()
|
||||
.identifierValue("J000000001")
|
||||
.issuingAuthority("")
|
||||
.build())
|
||||
.build()
|
||||
))
|
||||
.partyLegalStructureType("")
|
||||
.build())
|
||||
.accounts(List.of(
|
||||
Account.builder()
|
||||
.accountStatus(AccountStatus.builder()
|
||||
.status("D")
|
||||
.build())
|
||||
.accountIdentification(List.of(
|
||||
AccountIdentification.builder()
|
||||
.accountIdentificationType("NUMERO_CUENTA")
|
||||
.accountIdentification(Identifier.builder()
|
||||
.identifierValue("01340025330253093528")
|
||||
.issuingAuthority("")
|
||||
.build())
|
||||
.build(),
|
||||
AccountIdentification.builder()
|
||||
.accountIdentificationType("NUMERO_BANCO")
|
||||
.accountIdentification(Identifier.builder()
|
||||
.identifierValue("01")
|
||||
.issuingAuthority("")
|
||||
.build())
|
||||
.build(),
|
||||
AccountIdentification.builder()
|
||||
.accountIdentificationType("CODIGO_PRODUCTO")
|
||||
.accountIdentification(Identifier.builder()
|
||||
.identifierValue("3980")
|
||||
.issuingAuthority("")
|
||||
.build())
|
||||
.build(),
|
||||
AccountIdentification.builder()
|
||||
.accountIdentificationType("CLASE_CUENTA")
|
||||
.accountIdentification(Identifier.builder()
|
||||
.identifierValue("80")
|
||||
.issuingAuthority("")
|
||||
.build())
|
||||
.build(),
|
||||
AccountIdentification.builder()
|
||||
.accountIdentificationType("TIPO_CUENTA")
|
||||
.accountIdentification(Identifier.builder()
|
||||
.identifierValue("MMK")
|
||||
.issuingAuthority("")
|
||||
.build())
|
||||
.build()
|
||||
))
|
||||
.accountDate(List.of())
|
||||
.accountBalance(List.of(
|
||||
AccountBalance.builder()
|
||||
.balanceAmount(BigDecimal.valueOf(390417.36))
|
||||
.balanceType("SALDO_DISPONIBLE")
|
||||
.build(),
|
||||
AccountBalance.builder()
|
||||
.balanceAmount(BigDecimal.valueOf(100000.00))
|
||||
.balanceType("MAXIMO_DIARIO")
|
||||
.build(),
|
||||
AccountBalance.builder()
|
||||
.balanceAmount(BigDecimal.valueOf(100000.00))
|
||||
.balanceType("MAXIMO_TRANSACCION")
|
||||
.build(),
|
||||
AccountBalance.builder()
|
||||
.balanceAmount(BigDecimal.valueOf(3000000.00))
|
||||
.balanceType("MAXIMO_MENSUAL")
|
||||
.build(),
|
||||
AccountBalance.builder()
|
||||
.balanceAmount(BigDecimal.valueOf(0.01))
|
||||
.balanceType("MINIMO_TRANSACCION")
|
||||
.build()
|
||||
))
|
||||
.accountCurrency(List.of(
|
||||
AccountCurrency.builder()
|
||||
.currencyCode("BS")
|
||||
.currencyType(CurrencyType.BASE)
|
||||
.build()
|
||||
))
|
||||
.accountDescription("TASCA RESTAURANT GOOD WORLD CEN, C.A.")
|
||||
.accountName("")
|
||||
.accountInvolvement(List.of(
|
||||
AccountInvolvement.builder()
|
||||
.accountInvolvementType("CONTACTO_TELEFONICO")
|
||||
.partyReference(Party.builder()
|
||||
.partyIdentification(List.of(
|
||||
PartyIdentification.builder()
|
||||
.partyIdentificationType(PartyIdentificationType.TELEPHONE_NUMBER)
|
||||
.partyIdentification(Identifier.builder()
|
||||
.identifierValue("04122710660")
|
||||
.issuingAuthority("")
|
||||
.build())
|
||||
.build()
|
||||
))
|
||||
.build())
|
||||
.build()
|
||||
))
|
||||
.build()
|
||||
))
|
||||
.build())
|
||||
.build(),
|
||||
statusResponse
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@ import java.util.Map;
|
||||
|
||||
public interface BusinessUseCase {
|
||||
<T> ApiResponse<T> execute(
|
||||
boolean isMock,
|
||||
String customerIbsNumber,
|
||||
Map<String, String> queryParams,
|
||||
Map<String, String> headers,
|
||||
|
||||
@ -1,16 +1,15 @@
|
||||
package com.banesco.module.legal_customer_product_directory.domain.dto.response;
|
||||
|
||||
import com.banesco.common.domain.model.StatusResponse;
|
||||
import com.banesco.module.legal_customer_product_directory.domain.model.CustomerProductAndServiceDirectory;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class LegalCustomerProductDirectoryResponse {
|
||||
private CustomerProductAndServiceDirectory customerProductAndServiceDirectory;
|
||||
private StatusResponse statusResponse;
|
||||
}
|
||||
|
||||
@ -2,15 +2,17 @@ package com.banesco.module.legal_customer_product_directory.domain.model;
|
||||
|
||||
import com.banesco.module.account.domain.model.Account;
|
||||
import com.banesco.module.party.domain.model.Party;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class CustomerProductAndServiceDirectory {
|
||||
private Party party;
|
||||
private List<Account> accounts;
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
package com.banesco.module.legal_customer_product_directory.infrastructure.client;
|
||||
|
||||
import com.banesco.common.application.helper.ErrorResponseHelper;
|
||||
import com.banesco.common.application.usecase.HttpClientUseCase;
|
||||
import com.banesco.common.domain.exception.ServiceUnavailableException;
|
||||
import com.banesco.common.domain.exception.SuccessException;
|
||||
import com.banesco.common.domain.model.ApiResponse;
|
||||
import com.banesco.common.domain.model.HttpRequest;
|
||||
import com.banesco.common.infrastructure.config.RestClientConfig;
|
||||
import com.banesco.common.infrastructure.context.RequestContext;
|
||||
import com.banesco.module.legal_customer_product_directory.application.usecase.BusinessUseCase;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
@ -16,29 +18,32 @@ import java.util.Map;
|
||||
@ApplicationScoped
|
||||
public class BusLegalCustomerDirectoryClient implements BusinessUseCase {
|
||||
private final HttpClientUseCase httpClientUseCase;
|
||||
private final ErrorResponseHelper errorResponseHelper;
|
||||
private final RestClientConfig.BusConfig busConfig;
|
||||
|
||||
@Inject
|
||||
public BusLegalCustomerDirectoryClient(
|
||||
HttpClientUseCase httpClientUseCase,
|
||||
ErrorResponseHelper errorResponseHelper,
|
||||
RestClientConfig restClientConfig
|
||||
) {
|
||||
this.httpClientUseCase = httpClientUseCase;
|
||||
this.errorResponseHelper = errorResponseHelper;
|
||||
this.busConfig = restClientConfig.getBusLegalCustomerConfig();
|
||||
log.info("Configuración cargada para bus-legal-customer-directory: {}", busConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> ApiResponse<T> execute(
|
||||
boolean isMock,
|
||||
String customerIbsNumber,
|
||||
Map<String, String> queryParams,
|
||||
Map<String, String> headers,
|
||||
Class<T> responseType
|
||||
) {
|
||||
log.info("Consultando información del cliente: {}", customerIbsNumber);
|
||||
String requestId = RequestContext.getRequestId();
|
||||
log.info("{} Consultando información del cliente: {}", requestId, customerIbsNumber);
|
||||
|
||||
if(isMock) {
|
||||
throw new SuccessException("200", null);
|
||||
}
|
||||
|
||||
try {
|
||||
HttpRequest request = HttpRequest.builder()
|
||||
@ -57,7 +62,7 @@ public class BusLegalCustomerDirectoryClient implements BusinessUseCase {
|
||||
return httpClientUseCase.execute(request);
|
||||
} catch (Exception e) {
|
||||
log.error("Error consultando cliente {}: {}", customerIbsNumber, e.getMessage());
|
||||
return errorResponseHelper.buildServiceUnavailableResponse();
|
||||
throw new ServiceUnavailableException("503", e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -165,7 +165,7 @@ public class LegalCustomerProductDirectoryResource {
|
||||
}
|
||||
},
|
||||
"statusResponse": {
|
||||
"statusCode": "000",
|
||||
"statusCode": "200",
|
||||
"message": "Operación exitosa"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,15 +1,17 @@
|
||||
package com.banesco.module.party.domain.model;
|
||||
|
||||
import com.banesco.common.domain.model.Name;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class Party {
|
||||
private List<Name> partyName;
|
||||
private PartyType partyType;
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
package com.banesco.module.party.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class PartyDateTime {
|
||||
private String dateTimeType;
|
||||
private String dateTime;
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
package com.banesco.module.party.domain.model;
|
||||
|
||||
import com.banesco.common.domain.model.Identifier;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class PartyIdentification {
|
||||
private PartyIdentificationType partyIdentificationType;
|
||||
private Identifier partyIdentification;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.banesco.module.security.infrastructure.client;
|
||||
|
||||
import com.banesco.common.application.helper.ErrorResponseHelper;
|
||||
import com.banesco.common.application.usecase.HttpClientUseCase;
|
||||
import com.banesco.common.domain.exception.ServiceUnavailableException;
|
||||
import com.banesco.common.domain.model.ApiResponse;
|
||||
import com.banesco.common.domain.model.HttpRequest;
|
||||
import com.banesco.common.infrastructure.config.RestClientConfig;
|
||||
@ -18,17 +18,14 @@ import java.util.Map;
|
||||
@ApplicationScoped
|
||||
public class RegisterSecurityClient implements SecurityUseCase {
|
||||
private final HttpClientUseCase httpClientUseCase;
|
||||
private final ErrorResponseHelper errorResponseHelper;
|
||||
private final RestClientConfig.RegisterSecurityConfig securityConfig;
|
||||
|
||||
@Inject
|
||||
public RegisterSecurityClient(
|
||||
HttpClientUseCase httpClientUseCase,
|
||||
ErrorResponseHelper errorResponseHelper,
|
||||
RestClientConfig restClientConfig
|
||||
) {
|
||||
this.httpClientUseCase = httpClientUseCase;
|
||||
this.errorResponseHelper = errorResponseHelper;
|
||||
this.securityConfig = restClientConfig.getRegisterSecurityConfig();
|
||||
log.info("Configuración cargada para register-security: {}", securityConfig);
|
||||
}
|
||||
@ -49,7 +46,7 @@ public class RegisterSecurityClient implements SecurityUseCase {
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Error registrando traza de seguridad: {}", e.getMessage(), e);
|
||||
return errorResponseHelper.buildServiceUnavailableResponse();
|
||||
throw new ServiceUnavailableException("503", e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user