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.version>3.14.1</compiler-plugin.version>
|
||||||
<compiler-plugin-surefire.version>3.5.4</compiler-plugin-surefire.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-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.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
|
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
|
||||||
@ -29,6 +30,13 @@
|
|||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</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>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
@ -76,6 +84,21 @@
|
|||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<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>
|
<plugin>
|
||||||
<groupId>${quarkus.platform.group-id}</groupId>
|
<groupId>${quarkus.platform.group-id}</groupId>
|
||||||
<artifactId>quarkus-maven-plugin</artifactId>
|
<artifactId>quarkus-maven-plugin</artifactId>
|
||||||
@ -86,6 +109,7 @@
|
|||||||
<goals>
|
<goals>
|
||||||
<goal>build</goal>
|
<goal>build</goal>
|
||||||
<goal>generate-code</goal>
|
<goal>generate-code</goal>
|
||||||
|
<goal>generate-code-tests</goal>
|
||||||
<goal>native-image-agent</goal>
|
<goal>native-image-agent</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
@ -97,13 +121,6 @@
|
|||||||
<version>${compiler-plugin.version}</version>
|
<version>${compiler-plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<parameters>true</parameters>
|
<parameters>true</parameters>
|
||||||
<annotationProcessorPaths>
|
|
||||||
<path>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<version>${lombok.version}</version>
|
|
||||||
</path>
|
|
||||||
</annotationProcessorPaths>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
@ -149,9 +166,21 @@
|
|||||||
</property>
|
</property>
|
||||||
</activation>
|
</activation>
|
||||||
<properties>
|
<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>
|
<quarkus.native.enabled>true</quarkus.native.enabled>
|
||||||
</properties>
|
</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>
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
</project>
|
</project>
|
||||||
@ -10,11 +10,11 @@
|
|||||||
#
|
#
|
||||||
# Then, build the image with:
|
# 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:
|
# 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
|
FROM quay.io/quarkus/quarkus-micro-image:2.0
|
||||||
|
|||||||
@ -83,25 +83,6 @@ public class ErrorResponseHelper {
|
|||||||
.build();
|
.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() {
|
public <T> ApiResponse<T> buildServiceUnavailableResponse() {
|
||||||
return new ApiResponse<>(null, createSuccessResponse("503"));
|
return new ApiResponse<>(null, createSuccessResponse("503"));
|
||||||
}
|
}
|
||||||
@ -123,7 +104,7 @@ public class ErrorResponseHelper {
|
|||||||
|
|
||||||
|
|
||||||
log.error(
|
log.error(
|
||||||
"[{}] Error {} -> {}",
|
"[{}] Message {} -> {}",
|
||||||
exception.getExceptionType(),
|
exception.getExceptionType(),
|
||||||
exception.getErrorCode(),
|
exception.getErrorCode(),
|
||||||
status.getMessage()
|
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;
|
package com.banesco.common.domain.model;
|
||||||
|
|
||||||
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
|
||||||
@ToString
|
@ToString
|
||||||
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@RegisterForReflection
|
||||||
public class Identifier {
|
public class Identifier {
|
||||||
private String identifierValue;
|
private String identifierValue;
|
||||||
private String issuingAuthority;
|
private String issuingAuthority;
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
package com.banesco.common.domain.model;
|
package com.banesco.common.domain.model;
|
||||||
|
|
||||||
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
|
||||||
@ToString
|
@ToString
|
||||||
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@RegisterForReflection
|
||||||
public class Name {
|
public class Name {
|
||||||
private String fullName;
|
private String fullName;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,16 @@
|
|||||||
package com.banesco.module.account.domain.model;
|
package com.banesco.module.account.domain.model;
|
||||||
|
|
||||||
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
|
||||||
@ToString
|
@ToString
|
||||||
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@RegisterForReflection
|
||||||
public class Account {
|
public class Account {
|
||||||
private AccountStatus accountStatus;
|
private AccountStatus accountStatus;
|
||||||
private List<AccountIdentification> accountIdentification;
|
private List<AccountIdentification> accountIdentification;
|
||||||
|
|||||||
@ -1,14 +1,16 @@
|
|||||||
package com.banesco.module.account.domain.model;
|
package com.banesco.module.account.domain.model;
|
||||||
|
|
||||||
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
|
||||||
@ToString
|
@ToString
|
||||||
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@RegisterForReflection
|
||||||
public class AccountBalance {
|
public class AccountBalance {
|
||||||
private BigDecimal balanceAmount;
|
private BigDecimal balanceAmount;
|
||||||
private String balanceType;
|
private String balanceType;
|
||||||
|
|||||||
@ -1,13 +1,15 @@
|
|||||||
package com.banesco.module.account.domain.model;
|
package com.banesco.module.account.domain.model;
|
||||||
|
|
||||||
import com.banesco.common.domain.model.CurrencyType;
|
import com.banesco.common.domain.model.CurrencyType;
|
||||||
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
|
||||||
@ToString
|
@ToString
|
||||||
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@RegisterForReflection
|
||||||
public class AccountCurrency {
|
public class AccountCurrency {
|
||||||
private String currencyCode;
|
private String currencyCode;
|
||||||
private CurrencyType currencyType;
|
private CurrencyType currencyType;
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
package com.banesco.module.account.domain.model;
|
package com.banesco.module.account.domain.model;
|
||||||
|
|
||||||
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
|
||||||
@ToString
|
@ToString
|
||||||
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@RegisterForReflection
|
||||||
public class AccountDateTime {
|
public class AccountDateTime {
|
||||||
private String dateType;
|
private String dateType;
|
||||||
private String date;
|
private String date;
|
||||||
|
|||||||
@ -1,13 +1,15 @@
|
|||||||
package com.banesco.module.account.domain.model;
|
package com.banesco.module.account.domain.model;
|
||||||
|
|
||||||
import com.banesco.common.domain.model.Identifier;
|
import com.banesco.common.domain.model.Identifier;
|
||||||
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
|
||||||
@ToString
|
@ToString
|
||||||
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@RegisterForReflection
|
||||||
public class AccountIdentification {
|
public class AccountIdentification {
|
||||||
private String accountIdentificationType;
|
private String accountIdentificationType;
|
||||||
private Identifier accountIdentification;
|
private Identifier accountIdentification;
|
||||||
|
|||||||
@ -1,13 +1,15 @@
|
|||||||
package com.banesco.module.account.domain.model;
|
package com.banesco.module.account.domain.model;
|
||||||
|
|
||||||
import com.banesco.module.party.domain.model.Party;
|
import com.banesco.module.party.domain.model.Party;
|
||||||
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
|
||||||
@ToString
|
@ToString
|
||||||
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@RegisterForReflection
|
||||||
public class AccountInvolvement {
|
public class AccountInvolvement {
|
||||||
private String accountInvolvementType;
|
private String accountInvolvementType;
|
||||||
private Party partyReference;
|
private Party partyReference;
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
package com.banesco.module.account.domain.model;
|
package com.banesco.module.account.domain.model;
|
||||||
|
|
||||||
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
|
||||||
@ToString
|
@ToString
|
||||||
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@RegisterForReflection
|
||||||
public class AccountStatus {
|
public class AccountStatus {
|
||||||
private String status;
|
private String status;
|
||||||
private String statusType;
|
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.application.helper.RequestValidatorHelper;
|
||||||
import com.banesco.common.domain.exception.BaseApiException;
|
import com.banesco.common.domain.exception.BaseApiException;
|
||||||
import com.banesco.common.domain.exception.ServiceUnavailableException;
|
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.BusinessUseCase;
|
||||||
import com.banesco.module.legal_customer_product_directory.application.usecase.LegalCustomerProductDirectoryUseCase;
|
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.request.LegalCustomerProductDirectoryRequest;
|
||||||
import com.banesco.module.legal_customer_product_directory.domain.dto.response.LegalCustomerProductDirectoryResponse;
|
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.enterprise.context.ApplicationScoped;
|
||||||
import jakarta.inject.Inject;
|
import jakarta.inject.Inject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ApplicationScoped
|
@ApplicationScoped
|
||||||
public class LegalCustomerProductDirectoryService implements LegalCustomerProductDirectoryUseCase {
|
public class LegalCustomerProductDirectoryService implements LegalCustomerProductDirectoryUseCase {
|
||||||
@ -41,29 +51,159 @@ public class LegalCustomerProductDirectoryService implements LegalCustomerProduc
|
|||||||
try {
|
try {
|
||||||
return business(request);
|
return business(request);
|
||||||
} catch (BaseApiException e) {
|
} catch (BaseApiException e) {
|
||||||
|
if(Objects.equals(e.getErrorCode(), "200")) {
|
||||||
|
return createSuccessMock();
|
||||||
|
}
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ServiceUnavailableException("503", e.getMessage(), null);
|
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(
|
private void validate(
|
||||||
LegalCustomerProductDirectoryRequest request
|
LegalCustomerProductDirectoryRequest request
|
||||||
) {
|
) {
|
||||||
requestValidatorHelper.validateRequired(request);
|
requestValidatorHelper.validateRequired(request);
|
||||||
requestValidatorHelper.validateFieldValues(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 {
|
public interface BusinessUseCase {
|
||||||
<T> ApiResponse<T> execute(
|
<T> ApiResponse<T> execute(
|
||||||
|
boolean isMock,
|
||||||
String customerIbsNumber,
|
String customerIbsNumber,
|
||||||
Map<String, String> queryParams,
|
Map<String, String> queryParams,
|
||||||
Map<String, String> headers,
|
Map<String, String> headers,
|
||||||
|
|||||||
@ -1,16 +1,15 @@
|
|||||||
package com.banesco.module.legal_customer_product_directory.domain.dto.response;
|
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 com.banesco.module.legal_customer_product_directory.domain.model.CustomerProductAndServiceDirectory;
|
||||||
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
|
||||||
@ToString
|
@ToString
|
||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@RegisterForReflection
|
||||||
public class LegalCustomerProductDirectoryResponse {
|
public class LegalCustomerProductDirectoryResponse {
|
||||||
private CustomerProductAndServiceDirectory customerProductAndServiceDirectory;
|
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.account.domain.model.Account;
|
||||||
import com.banesco.module.party.domain.model.Party;
|
import com.banesco.module.party.domain.model.Party;
|
||||||
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
|
||||||
@ToString
|
@ToString
|
||||||
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@RegisterForReflection
|
||||||
public class CustomerProductAndServiceDirectory {
|
public class CustomerProductAndServiceDirectory {
|
||||||
private Party party;
|
private Party party;
|
||||||
private List<Account> accounts;
|
private List<Account> accounts;
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
package com.banesco.module.legal_customer_product_directory.infrastructure.client;
|
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.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.ApiResponse;
|
||||||
import com.banesco.common.domain.model.HttpRequest;
|
import com.banesco.common.domain.model.HttpRequest;
|
||||||
import com.banesco.common.infrastructure.config.RestClientConfig;
|
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 com.banesco.module.legal_customer_product_directory.application.usecase.BusinessUseCase;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import jakarta.enterprise.context.ApplicationScoped;
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
@ -16,29 +18,32 @@ import java.util.Map;
|
|||||||
@ApplicationScoped
|
@ApplicationScoped
|
||||||
public class BusLegalCustomerDirectoryClient implements BusinessUseCase {
|
public class BusLegalCustomerDirectoryClient implements BusinessUseCase {
|
||||||
private final HttpClientUseCase httpClientUseCase;
|
private final HttpClientUseCase httpClientUseCase;
|
||||||
private final ErrorResponseHelper errorResponseHelper;
|
|
||||||
private final RestClientConfig.BusConfig busConfig;
|
private final RestClientConfig.BusConfig busConfig;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public BusLegalCustomerDirectoryClient(
|
public BusLegalCustomerDirectoryClient(
|
||||||
HttpClientUseCase httpClientUseCase,
|
HttpClientUseCase httpClientUseCase,
|
||||||
ErrorResponseHelper errorResponseHelper,
|
|
||||||
RestClientConfig restClientConfig
|
RestClientConfig restClientConfig
|
||||||
) {
|
) {
|
||||||
this.httpClientUseCase = httpClientUseCase;
|
this.httpClientUseCase = httpClientUseCase;
|
||||||
this.errorResponseHelper = errorResponseHelper;
|
|
||||||
this.busConfig = restClientConfig.getBusLegalCustomerConfig();
|
this.busConfig = restClientConfig.getBusLegalCustomerConfig();
|
||||||
log.info("Configuración cargada para bus-legal-customer-directory: {}", busConfig);
|
log.info("Configuración cargada para bus-legal-customer-directory: {}", busConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> ApiResponse<T> execute(
|
public <T> ApiResponse<T> execute(
|
||||||
|
boolean isMock,
|
||||||
String customerIbsNumber,
|
String customerIbsNumber,
|
||||||
Map<String, String> queryParams,
|
Map<String, String> queryParams,
|
||||||
Map<String, String> headers,
|
Map<String, String> headers,
|
||||||
Class<T> responseType
|
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 {
|
try {
|
||||||
HttpRequest request = HttpRequest.builder()
|
HttpRequest request = HttpRequest.builder()
|
||||||
@ -57,7 +62,7 @@ public class BusLegalCustomerDirectoryClient implements BusinessUseCase {
|
|||||||
return httpClientUseCase.execute(request);
|
return httpClientUseCase.execute(request);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error consultando cliente {}: {}", customerIbsNumber, e.getMessage());
|
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": {
|
"statusResponse": {
|
||||||
"statusCode": "000",
|
"statusCode": "200",
|
||||||
"message": "Operación exitosa"
|
"message": "Operación exitosa"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,17 @@
|
|||||||
package com.banesco.module.party.domain.model;
|
package com.banesco.module.party.domain.model;
|
||||||
|
|
||||||
import com.banesco.common.domain.model.Name;
|
import com.banesco.common.domain.model.Name;
|
||||||
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
|
||||||
@ToString
|
@ToString
|
||||||
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@RegisterForReflection
|
||||||
public class Party {
|
public class Party {
|
||||||
private List<Name> partyName;
|
private List<Name> partyName;
|
||||||
private PartyType partyType;
|
private PartyType partyType;
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
package com.banesco.module.party.domain.model;
|
package com.banesco.module.party.domain.model;
|
||||||
|
|
||||||
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
|
||||||
@ToString
|
@ToString
|
||||||
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@RegisterForReflection
|
||||||
public class PartyDateTime {
|
public class PartyDateTime {
|
||||||
private String dateTimeType;
|
private String dateTimeType;
|
||||||
private String dateTime;
|
private String dateTime;
|
||||||
|
|||||||
@ -1,13 +1,15 @@
|
|||||||
package com.banesco.module.party.domain.model;
|
package com.banesco.module.party.domain.model;
|
||||||
|
|
||||||
import com.banesco.common.domain.model.Identifier;
|
import com.banesco.common.domain.model.Identifier;
|
||||||
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
|
||||||
@ToString
|
@ToString
|
||||||
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@RegisterForReflection
|
||||||
public class PartyIdentification {
|
public class PartyIdentification {
|
||||||
private PartyIdentificationType partyIdentificationType;
|
private PartyIdentificationType partyIdentificationType;
|
||||||
private Identifier partyIdentification;
|
private Identifier partyIdentification;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.banesco.module.security.infrastructure.client;
|
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.application.usecase.HttpClientUseCase;
|
||||||
|
import com.banesco.common.domain.exception.ServiceUnavailableException;
|
||||||
import com.banesco.common.domain.model.ApiResponse;
|
import com.banesco.common.domain.model.ApiResponse;
|
||||||
import com.banesco.common.domain.model.HttpRequest;
|
import com.banesco.common.domain.model.HttpRequest;
|
||||||
import com.banesco.common.infrastructure.config.RestClientConfig;
|
import com.banesco.common.infrastructure.config.RestClientConfig;
|
||||||
@ -18,17 +18,14 @@ import java.util.Map;
|
|||||||
@ApplicationScoped
|
@ApplicationScoped
|
||||||
public class RegisterSecurityClient implements SecurityUseCase {
|
public class RegisterSecurityClient implements SecurityUseCase {
|
||||||
private final HttpClientUseCase httpClientUseCase;
|
private final HttpClientUseCase httpClientUseCase;
|
||||||
private final ErrorResponseHelper errorResponseHelper;
|
|
||||||
private final RestClientConfig.RegisterSecurityConfig securityConfig;
|
private final RestClientConfig.RegisterSecurityConfig securityConfig;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RegisterSecurityClient(
|
public RegisterSecurityClient(
|
||||||
HttpClientUseCase httpClientUseCase,
|
HttpClientUseCase httpClientUseCase,
|
||||||
ErrorResponseHelper errorResponseHelper,
|
|
||||||
RestClientConfig restClientConfig
|
RestClientConfig restClientConfig
|
||||||
) {
|
) {
|
||||||
this.httpClientUseCase = httpClientUseCase;
|
this.httpClientUseCase = httpClientUseCase;
|
||||||
this.errorResponseHelper = errorResponseHelper;
|
|
||||||
this.securityConfig = restClientConfig.getRegisterSecurityConfig();
|
this.securityConfig = restClientConfig.getRegisterSecurityConfig();
|
||||||
log.info("Configuración cargada para register-security: {}", securityConfig);
|
log.info("Configuración cargada para register-security: {}", securityConfig);
|
||||||
}
|
}
|
||||||
@ -49,7 +46,7 @@ public class RegisterSecurityClient implements SecurityUseCase {
|
|||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error registrando traza de seguridad: {}", e.getMessage(), 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