update error messages into private api; update generals
This commit is contained in:
parent
f34cb89110
commit
14f0b0b049
Binary file not shown.
@ -14,6 +14,9 @@ import java.math.BigDecimal;
|
||||
public class RequestValidatorHelper {
|
||||
private final RequestValidationConfig config;
|
||||
|
||||
private static final String REQUIRED_CODE = "VDE01";
|
||||
private static final String VALIDATE_CODE = "VDE02";
|
||||
|
||||
@Inject
|
||||
public RequestValidatorHelper(
|
||||
RequestValidationConfig config
|
||||
@ -32,6 +35,7 @@ public class RequestValidatorHelper {
|
||||
required(request.getPurpose(), "paymentInitiationTransaction.paymentPurpose");
|
||||
required(request.getPurpose(), "paymentInitiationTransaction.paymentPurpose");
|
||||
required(request.getChannelCode(), "procedureRequest.instructionPurposeType");
|
||||
required(request.getCustomerReferenceFintechId(), "customerReferenceFintechId");
|
||||
required(request.getAppId(), "appId");
|
||||
}
|
||||
|
||||
@ -46,25 +50,25 @@ public class RequestValidatorHelper {
|
||||
|
||||
private void required(String value, String fieldName) {
|
||||
if (value == null || value.trim().isEmpty()) {
|
||||
throw HttpStatusCodeException.badRequest("VDE01", fieldName);
|
||||
throw HttpStatusCodeException.badRequest(REQUIRED_CODE, fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
private void required(BigDecimal value, String fieldName) {
|
||||
if (value == null) {
|
||||
throw HttpStatusCodeException.badRequest("VDE01", fieldName);
|
||||
throw HttpStatusCodeException.badRequest(REQUIRED_CODE, fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
private void validate(String value, String regex, String fieldName) {
|
||||
if (value != null && !value.isEmpty() && !value.matches(regex)) {
|
||||
throw HttpStatusCodeException.badRequest("VDE02", fieldName);
|
||||
throw HttpStatusCodeException.badRequest(VALIDATE_CODE, fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
private void validate(BigDecimal value, String fieldName) {
|
||||
if (value != null && value.compareTo(BigDecimal.ZERO) < 1) {
|
||||
throw HttpStatusCodeException.badRequest("VDE02", fieldName);
|
||||
throw HttpStatusCodeException.badRequest(VALIDATE_CODE, fieldName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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,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,
|
||||
}
|
||||
@ -217,7 +217,7 @@ public class PaymentInitiationRequestResource {
|
||||
})
|
||||
public Response initiate(
|
||||
@HeaderParam("customerReferenceFintechId")
|
||||
@Parameter(description = "ID de la fintech", required = true, example = "pranical-test")
|
||||
@Parameter(description = "ID de la fintech", required = true, example = "provider-test")
|
||||
String customerReferenceFintechId,
|
||||
|
||||
@HeaderParam("appId")
|
||||
@ -234,7 +234,7 @@ public class PaymentInitiationRequestResource {
|
||||
value = """
|
||||
{
|
||||
"paymentInitiationTransaction": {
|
||||
"paymentTransactionType": "MOBILE_PAYMENT",
|
||||
"paymentTransactionType": "PAGO_MOVIL",
|
||||
"payerReference": {
|
||||
"partyIdentification": [
|
||||
{
|
||||
|
||||
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