update error messages into private api; update generals
This commit is contained in:
parent
e335c3095a
commit
5c211aa0cf
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
|||||||
<artifactId>bus-payment-instruction-request</artifactId>
|
<artifactId>bus-payment-instruction-request</artifactId>
|
||||||
<version>1.0-native-quarkus-jdk17</version>
|
<version>1.0-native-quarkus-jdk17</version>
|
||||||
<name>bus-payment-instruction-request</name>
|
<name>bus-payment-instruction-request</name>
|
||||||
<description>API Business - Create payment single request</description>
|
<description>API Business - Create payment multiple request</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.release>17</maven.compiler.release>
|
<maven.compiler.release>17</maven.compiler.release>
|
||||||
|
|||||||
Binary file not shown.
@ -28,10 +28,12 @@ public class PartyValidateHelper {
|
|||||||
!Objects.isNull(blackListRec) &&
|
!Objects.isNull(blackListRec) &&
|
||||||
!StringUtil.isNullOrEmpty(blackListRec.getBlackListBanesco()) &&
|
!StringUtil.isNullOrEmpty(blackListRec.getBlackListBanesco()) &&
|
||||||
!StringUtil.isNullOrEmpty(blackListRec.getBlackListCbn()) &&
|
!StringUtil.isNullOrEmpty(blackListRec.getBlackListCbn()) &&
|
||||||
blackListRec.getBlackListBanesco().equalsIgnoreCase("N") &&
|
(
|
||||||
blackListRec.getBlackListCbn().equalsIgnoreCase("N")
|
!blackListRec.getBlackListBanesco().equalsIgnoreCase("N") ||
|
||||||
|
!blackListRec.getBlackListCbn().equalsIgnoreCase("N")
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
return;
|
throw HttpStatusCodeException.unauthorized("VRN13");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,6 +48,17 @@ public class PartyValidateHelper {
|
|||||||
List<String> errors = extractErrorCodes(status);
|
List<String> errors = extractErrorCodes(status);
|
||||||
|
|
||||||
if(!errors.isEmpty()) {
|
if(!errors.isEmpty()) {
|
||||||
|
if(
|
||||||
|
errors.size() == 1 &&
|
||||||
|
(
|
||||||
|
Objects.equals(errors.get(0), "388") ||
|
||||||
|
errors.get(0).equalsIgnoreCase("AFPM388")
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
log.error("Error del estatus controlado: {}", errors.get(0));
|
||||||
|
throw HttpStatusCodeException.forbidden("VRN20");
|
||||||
|
}
|
||||||
|
|
||||||
AdditionalStatus additionalStatus = getFirstAdditionalStatus(status);
|
AdditionalStatus additionalStatus = getFirstAdditionalStatus(status);
|
||||||
String error = String.join("-", errors);
|
String error = String.join("-", errors);
|
||||||
String desc = (!Objects.isNull(additionalStatus))
|
String desc = (!Objects.isNull(additionalStatus))
|
||||||
@ -75,7 +88,6 @@ public class PartyValidateHelper {
|
|||||||
|
|
||||||
private static List<String> extractErrorCodes(Status status) {
|
private static List<String> extractErrorCodes(Status status) {
|
||||||
List<String> errors = new ArrayList<>();
|
List<String> errors = new ArrayList<>();
|
||||||
|
|
||||||
List<AdditionalStatus> additionalStatuses = status.getAdditionalStatus();
|
List<AdditionalStatus> additionalStatuses = status.getAdditionalStatus();
|
||||||
|
|
||||||
if(Objects.isNull(additionalStatuses) || additionalStatuses.isEmpty()) {
|
if(Objects.isNull(additionalStatuses) || additionalStatuses.isEmpty()) {
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import io.quarkus.runtime.annotations.RegisterForReflection;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ToString
|
@ToString
|
||||||
@RegisterForReflection
|
@RegisterForReflection
|
||||||
@ -13,4 +15,5 @@ public class SecurityTraceConfig {
|
|||||||
private String url;
|
private String url;
|
||||||
private TimeoutConfig timeout;
|
private TimeoutConfig timeout;
|
||||||
private SecurityTraceRequest request;
|
private SecurityTraceRequest request;
|
||||||
|
private Map<String, String> converters;
|
||||||
}
|
}
|
||||||
@ -29,6 +29,8 @@ public class SecurityTraceClient implements SecurityTraceUseCase {
|
|||||||
private final RestClientConfig restClientConfig;
|
private final RestClientConfig restClientConfig;
|
||||||
private final SecurityTraceConfig securityTraceConfig;
|
private final SecurityTraceConfig securityTraceConfig;
|
||||||
|
|
||||||
|
private static final String PAYMENT_INSTRUCTION_TRANSACTION_KEY = "paymentInstructionTransaction";
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public SecurityTraceClient(
|
public SecurityTraceClient(
|
||||||
HttpClientUseCase httpClientUseCase,
|
HttpClientUseCase httpClientUseCase,
|
||||||
@ -148,7 +150,7 @@ public class SecurityTraceClient implements SecurityTraceUseCase {
|
|||||||
|
|
||||||
Map<String, Object> apiRequestMap = restClientConfig.toMap(apiRequest);
|
Map<String, Object> apiRequestMap = restClientConfig.toMap(apiRequest);
|
||||||
Map<String, Object> paymentInstructionTransaction =
|
Map<String, Object> paymentInstructionTransaction =
|
||||||
(Map<String, Object>) apiRequestMap.get("paymentInstructionTransaction");
|
(Map<String, Object>) apiRequestMap.get(PAYMENT_INSTRUCTION_TRANSACTION_KEY);
|
||||||
|
|
||||||
if(Objects.isNull(paymentInstructionTransaction)) {
|
if(Objects.isNull(paymentInstructionTransaction)) {
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -159,7 +161,7 @@ public class SecurityTraceClient implements SecurityTraceUseCase {
|
|||||||
apiRequest.getPaymentInstructionTransaction().getPaymentArrangement().size()
|
apiRequest.getPaymentInstructionTransaction().getPaymentArrangement().size()
|
||||||
);
|
);
|
||||||
|
|
||||||
apiRequestMap.put("paymentInstructionTransaction", paymentInstructionTransaction);
|
apiRequestMap.put(PAYMENT_INSTRUCTION_TRANSACTION_KEY, paymentInstructionTransaction);
|
||||||
|
|
||||||
return apiRequestMap;
|
return apiRequestMap;
|
||||||
}
|
}
|
||||||
@ -180,7 +182,7 @@ public class SecurityTraceClient implements SecurityTraceUseCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> paymentInstructionTransaction =
|
Map<String, Object> paymentInstructionTransaction =
|
||||||
(Map<String, Object>) data.get("paymentInstructionTransaction");
|
(Map<String, Object>) data.get(PAYMENT_INSTRUCTION_TRANSACTION_KEY);
|
||||||
|
|
||||||
if(Objects.isNull(paymentInstructionTransaction)) {
|
if(Objects.isNull(paymentInstructionTransaction)) {
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -191,7 +193,7 @@ public class SecurityTraceClient implements SecurityTraceUseCase {
|
|||||||
apiResponseData.getData().getPaymentInstructionTransaction().getPaymentArrangement().size()
|
apiResponseData.getData().getPaymentInstructionTransaction().getPaymentArrangement().size()
|
||||||
);
|
);
|
||||||
|
|
||||||
data.put("paymentInstructionTransaction", paymentInstructionTransaction);
|
data.put(PAYMENT_INSTRUCTION_TRANSACTION_KEY, paymentInstructionTransaction);
|
||||||
|
|
||||||
apiResponseMap.put("data", data);
|
apiResponseMap.put("data", data);
|
||||||
|
|
||||||
|
|||||||
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