update error messages into private api; update generals
This commit is contained in:
parent
63d971880c
commit
a9e5d0394f
Binary file not shown.
@ -28,10 +28,12 @@ public class PartyValidateHelper {
|
||||
!Objects.isNull(blackListRec) &&
|
||||
!StringUtil.isNullOrEmpty(blackListRec.getBlackListBanesco()) &&
|
||||
!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);
|
||||
|
||||
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);
|
||||
String error = String.join("-", errors);
|
||||
String desc = (!Objects.isNull(additionalStatus))
|
||||
@ -75,7 +88,6 @@ public class PartyValidateHelper {
|
||||
|
||||
private static List<String> extractErrorCodes(Status status) {
|
||||
List<String> errors = new ArrayList<>();
|
||||
|
||||
List<AdditionalStatus> additionalStatuses = status.getAdditionalStatus();
|
||||
|
||||
if(Objects.isNull(additionalStatuses) || additionalStatuses.isEmpty()) {
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
package com.banesco.common.domain.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class Location {
|
||||
private String locationValue; // directorio
|
||||
}
|
||||
@ -32,8 +32,7 @@ public class PaymentInitiationRequestRequest {
|
||||
@JsonIgnore
|
||||
public String getPaymentTransactionType() {
|
||||
return paymentInitiationTransaction
|
||||
.getPaymentTransactionType()
|
||||
.name();
|
||||
.getPaymentTransactionType();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
|
||||
@ -14,7 +14,7 @@ import java.math.BigDecimal;
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class PaymentInitiationTransactionInstanceRecord {
|
||||
private PaymentTransactionType paymentTransactionType; // operationTypeCode
|
||||
private String paymentTransactionType; // operationTypeCode
|
||||
private Payer payerReference; // applicantId
|
||||
private Payee payeeReference; // recipientId
|
||||
private BigDecimal amount; // amount
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
package com.banesco.module.payment_initiation_request.domain.model;
|
||||
|
||||
public enum PaymentTransactionType {
|
||||
MOBILE_PAYMENT,
|
||||
}
|
||||
@ -227,7 +227,7 @@ public class PaymentInitiationRequestResource {
|
||||
"customerReferenceFintechId": "provider-test",
|
||||
"appId": "DANIAPP",
|
||||
"paymentInitiationTransaction": {
|
||||
"paymentTransactionType": "MOBILE_PAYMENT",
|
||||
"paymentTransactionType": "PAGO_MOVIL",
|
||||
"payerReference": {
|
||||
"partyIdentification": [
|
||||
{
|
||||
|
||||
@ -6,6 +6,8 @@ import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@RegisterForReflection
|
||||
@ -13,4 +15,5 @@ public class SecurityTraceConfig {
|
||||
private String url;
|
||||
private TimeoutConfig timeout;
|
||||
private SecurityTraceRequest request;
|
||||
private Map<String, String> converters;
|
||||
}
|
||||
@ -6,6 +6,7 @@ import com.banesco.common.domain.model.ApiResponse;
|
||||
import com.banesco.common.domain.model.HttpRequest;
|
||||
import com.banesco.common.infrastructure.config.RestClientConfig;
|
||||
import com.banesco.module.payment_initiation_request.domain.dto.request.PaymentInitiationRequestRequest;
|
||||
import com.banesco.module.payment_initiation_request.domain.dto.response.PaymentInitiationRequestResponse;
|
||||
import com.banesco.module.security_trace.application.usecase.SecurityTraceUseCase;
|
||||
import com.banesco.module.security_trace.domain.dto.request.SecurityTraceRequest;
|
||||
import com.banesco.module.security_trace.domain.model.SecurityTraceConfig;
|
||||
@ -17,6 +18,7 @@ import jakarta.ws.rs.core.Response;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@ApplicationScoped
|
||||
@ -92,15 +94,13 @@ public class SecurityTraceClient implements SecurityTraceUseCase {
|
||||
int statusHttp = apiResponse.getStatus();
|
||||
String payerId = apiRequest.getPayerId();
|
||||
String payeeId = apiRequest.getPayeeId();
|
||||
String codMon = (!StringUtil.isNullOrEmpty(apiRequest.getCurrency()))
|
||||
? apiRequest.getCurrency()
|
||||
: securityTraceConfig.getRequest().getCodMon();
|
||||
ApiResponse<?> apiResponseData = (ApiResponse<?>) apiResponse.getEntity();
|
||||
ApiResponse<PaymentInitiationRequestResponse> apiResponseData =
|
||||
(ApiResponse<PaymentInitiationRequestResponse>) apiResponse.getEntity();
|
||||
|
||||
return SecurityTraceRequest.builder()
|
||||
.sp(securityTraceConfig.getRequest().getSp())
|
||||
.codBan(securityTraceConfig.getRequest().getCodBan())
|
||||
.codMon(codMon)
|
||||
.codMon(getCodMon(apiRequest))
|
||||
.codEve(securityTraceConfig.getRequest().getCodEve())
|
||||
.codEve2(securityTraceConfig.getRequest().getCodEve2())
|
||||
.login(apiRequest.getChannelCode())
|
||||
@ -110,6 +110,7 @@ public class SecurityTraceClient implements SecurityTraceUseCase {
|
||||
.nacBen(payeeId.substring(0, 1).toUpperCase())
|
||||
.cedBen(getPartyIdNumber(payeeId.substring(1)))
|
||||
.monto(apiRequest.getAmount())
|
||||
.referencia(getReference(apiResponseData))
|
||||
.desPago(apiRequest.getPurpose())
|
||||
.objeto(
|
||||
restClientConfig.toJsonString(SecurityTraceObject.builder()
|
||||
@ -128,6 +129,46 @@ public class SecurityTraceClient implements SecurityTraceUseCase {
|
||||
.build();
|
||||
}
|
||||
|
||||
private String getCodMon(
|
||||
PaymentInitiationRequestRequest apiRequest
|
||||
) {
|
||||
String defaultCurrency = securityTraceConfig.getRequest().getCodMon();
|
||||
|
||||
if (StringUtil.isNullOrEmpty(apiRequest.getCurrency())) {
|
||||
log.info("Moneda asignada por defecto: {}", defaultCurrency);
|
||||
return defaultCurrency;
|
||||
}
|
||||
|
||||
String currency = apiRequest.getCurrency().toUpperCase();
|
||||
|
||||
defaultCurrency = securityTraceConfig.getConverters()
|
||||
.getOrDefault(currency, currency);
|
||||
|
||||
log.info("Moneda convertida o por defecto: {} -> {}", currency, defaultCurrency);
|
||||
|
||||
return defaultCurrency;
|
||||
}
|
||||
|
||||
private String getReference(
|
||||
ApiResponse<PaymentInitiationRequestResponse> apiResponseData
|
||||
) {
|
||||
if(
|
||||
!Objects.isNull(apiResponseData) &&
|
||||
!Objects.isNull(apiResponseData.getData()) &&
|
||||
!Objects.isNull(apiResponseData.getData().getPaymentInitiationTransaction()) &&
|
||||
!Objects.isNull(apiResponseData.getData().getPaymentInitiationTransaction().getTransaction()) &&
|
||||
!Objects.isNull(apiResponseData.getData().getPaymentInitiationTransaction().getTransaction().getTransactionIdentification())
|
||||
) {
|
||||
return apiResponseData.getData()
|
||||
.getPaymentInitiationTransaction()
|
||||
.getTransaction()
|
||||
.getTransactionIdentification()
|
||||
.getIdentifierValue();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getStatusMessage(
|
||||
ApiResponse<?> apiResponseData,
|
||||
int statusHttp
|
||||
|
||||
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