diff --git a/pom.xml b/pom.xml index 14a1594..c364d2e 100644 --- a/pom.xml +++ b/pom.xml @@ -144,6 +144,12 @@ 4.3.1 test + + org.bouncycastle + bcpkix-jdk18on + 1.72 + test + diff --git a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/ErrorCode.java b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/ErrorCode.java index 19ad86f..9d270ae 100644 --- a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/ErrorCode.java +++ b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/ErrorCode.java @@ -60,6 +60,8 @@ public final class ErrorCode { // integration error node - rest client public static final String ERROR_CALLING_NODE_REST_SERVICES = MODULE_ID + "000029"; + public static final String ERROR_CALLING_MIL_REST_SERVICES = MODULE_ID + "00002A"; + private ErrorCode() { } diff --git a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/client/MilRestService.java b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/client/MilRestService.java new file mode 100644 index 0000000..720f1b9 --- /dev/null +++ b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/client/MilRestService.java @@ -0,0 +1,31 @@ +package it.gov.pagopa.swclient.mil.paymentnotice.client; + +import io.smallrye.mutiny.Uni; +import it.gov.pagopa.swclient.mil.paymentnotice.client.bean.AcquirerConfiguration; +import org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam; +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; + +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; + +/** + * Reactive rest client for the REST APIs exposed by the MIL APIM + */ +@RegisterRestClient(configKey = "mil-rest-api") +public interface MilRestService { + + /** + * Retrieves the psp configuration + * @param requestId the id of the request + * @param acquirerId the acquirer id passed in request + * @return the psp configuration for the acquirer id + */ + @GET + @Path("/mil-acquirer-conf/confs/{acquirerId}/psp") + @ClientHeaderParam(name = "Ocp-Apim-Subscription-Key", value = "${mil-rest-client.apim-subscription-key}", required = false) + @ClientHeaderParam(name = "Version", value = "${mil-rest-client.mil-acquirer-conf.version}", required = false) + Uni getPspConfiguration(@HeaderParam(value = "RequestId") String requestId, @PathParam(value = "acquirerId") String acquirerId); + +} diff --git a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/client/bean/AcquirerConfiguration.java b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/client/bean/AcquirerConfiguration.java new file mode 100644 index 0000000..1b8cc6d --- /dev/null +++ b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/client/bean/AcquirerConfiguration.java @@ -0,0 +1,63 @@ +package it.gov.pagopa.swclient.mil.paymentnotice.client.bean; + +/** + * + */ +public class AcquirerConfiguration { + + /** + * The psp configuration to be used when calling the "verify" and "activate" APIs of the node + */ + private PspConfiguration pspConfigForVerifyAndActivate; + + /** + * The psp configuration to be used when calling the "close" API of the node and the "getFee" api of GEC + */ + private PspConfiguration pspConfigForGetFeeAndClosePayment; + + /** + * Gets pspConfigForVerifyAndActivate + * + * @return value of pspConfigForVerifyAndActivate + */ + public PspConfiguration getPspConfigForVerifyAndActivate() { + return pspConfigForVerifyAndActivate; + } + + /** + * Sets pspConfigForVerifyAndActivate + * + * @param pspConfigForVerifyAndActivate value of pspConfigForVerifyAndActivate + */ + public void setPspConfigForVerifyAndActivate(PspConfiguration pspConfigForVerifyAndActivate) { + this.pspConfigForVerifyAndActivate = pspConfigForVerifyAndActivate; + } + + /** + * Gets pspConfigForGetFeeAndClosePayment + * + * @return value of pspConfigForGetFeeAndClosePayment + */ + public PspConfiguration getPspConfigForGetFeeAndClosePayment() { + return pspConfigForGetFeeAndClosePayment; + } + + /** + * Sets pspConfigForGetFeeAndClosePayment + * + * @param pspConfigForGetFeeAndClosePayment value of pspConfigForGetFeeAndClosePayment + */ + public void setPspConfigForGetFeeAndClosePayment(PspConfiguration pspConfigForGetFeeAndClosePayment) { + this.pspConfigForGetFeeAndClosePayment = pspConfigForGetFeeAndClosePayment; + } + + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("PspConfiguration{"); + sb.append("pspConfigForVerifyAndActivate=").append(pspConfigForVerifyAndActivate); + sb.append(", pspConfigForGetFeeAndClosePayment=").append(pspConfigForGetFeeAndClosePayment); + sb.append('}'); + return sb.toString(); + } +} diff --git a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/client/bean/PspConfiguration.java b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/client/bean/PspConfiguration.java new file mode 100644 index 0000000..a99387d --- /dev/null +++ b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/client/bean/PspConfiguration.java @@ -0,0 +1,104 @@ +package it.gov.pagopa.swclient.mil.paymentnotice.client.bean; + +/** + * Configuration of a PSP used when connecting to the node + */ +public class PspConfiguration { + + /** + * Identifier of the PSP, assigned by PagoPA + */ + private String psp; + + /** + * Identifier of the broker, assigned by PagoPA + */ + private String broker; + + /** + * Identifier of the channel used for the payment transaction. + * Is assigned by PagoPA and is unique for the psp + */ + private String channel; + + /** + * Channel's password, assigned by PagoPA + */ + private String password; + + + /** + * Gets psp + * @return value of psp + */ + public String getPsp() { + return psp; + } + + /** + * Sets psp + * @param psp value of psp + */ + public void setPsp(String psp) { + this.psp = psp; + } + + /** + * Gets broker + * @return value of broker + */ + public String getBroker() { + return broker; + } + + /** + * Sets broker + * @param broker value of broker + */ + public void setBroker(String broker) { + this.broker = broker; + } + + /** + * Gets channel + * @return value of channel + */ + public String getChannel() { + return channel; + } + + /** + * Sets channel + * @param channel value of channel + */ + public void setChannel(String channel) { + this.channel = channel; + } + + /** + * Gets password + * @return value of password + */ + public String getPassword() { + return password; + } + + /** + * Sets password + * @param password value of password + */ + public void setPassword(String password) { + this.password = password; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("PspConfiguration{"); + sb.append("psp='").append(psp).append('\''); + sb.append(", broker='").append(broker).append('\''); + sb.append(", channel='").append(channel).append('\''); + sb.append(", password='").append(password).append('\''); + sb.append('}'); + return sb.toString(); + } +} diff --git a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/dao/PspConfRepository.java b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/dao/PspConfRepository.java index a63c4b7..aedde3a 100644 --- a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/dao/PspConfRepository.java +++ b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/dao/PspConfRepository.java @@ -5,7 +5,7 @@ import io.quarkus.mongodb.panache.reactive.ReactivePanacheMongoRepository; /** - * MongoDB repository to access PPS configuration data, reactive flavor + * MongoDB repository to access PSP configuration data, reactive flavor */ @ApplicationScoped public class PspConfRepository implements ReactivePanacheMongoRepository { diff --git a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/dao/PspConfiguration.java b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/dao/PspConfiguration.java index 8305ced..5d1a24d 100644 --- a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/dao/PspConfiguration.java +++ b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/dao/PspConfiguration.java @@ -22,7 +22,7 @@ public class PspConfiguration { private String idChannel; /** - * Channel's password, , assigned by PagoPA + * Channel's password, assigned by PagoPA */ private String pspPassword; diff --git a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/resource/ActivatePaymentNoticeResource.java b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/resource/ActivatePaymentNoticeResource.java index d61ab21..63bb822 100644 --- a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/resource/ActivatePaymentNoticeResource.java +++ b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/resource/ActivatePaymentNoticeResource.java @@ -19,6 +19,8 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +import it.gov.pagopa.swclient.mil.paymentnotice.client.bean.PspConfiguration; +import it.gov.pagopa.swclient.mil.paymentnotice.utils.NodeApi; import it.gov.pagopa.swclient.mil.paymentnotice.utils.QrCode; import org.apache.commons.lang3.StringUtils; import org.eclipse.microprofile.config.inject.ConfigProperty; @@ -34,7 +36,6 @@ import it.gov.pagopa.swclient.mil.paymentnotice.bean.ActivatePaymentNoticeRequest; import it.gov.pagopa.swclient.mil.paymentnotice.bean.ActivatePaymentNoticeResponse; import it.gov.pagopa.swclient.mil.paymentnotice.bean.Outcome; -import it.gov.pagopa.swclient.mil.paymentnotice.dao.PspConfiguration; import it.gov.pagopa.swclient.mil.paymentnotice.bean.Transfer; import it.gov.pagopa.swclient.mil.paymentnotice.utils.PaymentNoticeConstants; @@ -71,7 +72,7 @@ public Uni activateByQrCode(@Valid @BeanParam CommonHeader headers, // parse qr-code to retrieve the notice number and the PA tax code QrCode parsedQrCode = QrCode.parse(qrCode); - return retrievePSPConfiguration(headers.getAcquirerId()). + return retrievePSPConfiguration(headers.getRequestId(), headers.getAcquirerId(), NodeApi.ACTIVATE). chain(pspConf -> callNodeActivatePaymentNotice(parsedQrCode.getPaTaxCode(), parsedQrCode.getNoticeNumber(), pspConf, activatePaymentNoticeRequest)); @@ -103,7 +104,7 @@ public Uni activateByTaxCodeAndNoticeNumber(@Valid @BeanParam CommonHe Log.debugf("activateByTaxCodeAndNoticeNumber - Input parameters: %s, paTaxCode: %s, noticeNumber, body: %s", headers, paTaxCode, noticeNumber, activatePaymentNoticeRequest); - return retrievePSPConfiguration(headers.getAcquirerId()). + return retrievePSPConfiguration(headers.getRequestId(), headers.getAcquirerId(), NodeApi.VERIFY). chain(pspConf -> callNodeActivatePaymentNotice(paTaxCode, noticeNumber, pspConf, activatePaymentNoticeRequest)); } @@ -125,10 +126,10 @@ private Uni callNodeActivatePaymentNotice(String paTaxCode, String not ctQrCode.setNoticeNumber(noticeNumber); ActivatePaymentNoticeV2Request nodeActivateRequest = new ActivatePaymentNoticeV2Request(); - nodeActivateRequest.setIdPSP(pspConfiguration.getPspId()); - nodeActivateRequest.setIdBrokerPSP(pspConfiguration.getPspBroker()); - nodeActivateRequest.setIdChannel(pspConfiguration.getIdChannel()); - nodeActivateRequest.setPassword(pspConfiguration.getPspPassword()); + nodeActivateRequest.setIdPSP(pspConfiguration.getPsp()); + nodeActivateRequest.setIdBrokerPSP(pspConfiguration.getBroker()); + nodeActivateRequest.setIdChannel(pspConfiguration.getChannel()); + nodeActivateRequest.setPassword(pspConfiguration.getPassword()); nodeActivateRequest.setIdempotencyKey(activatePaymentNoticeRequest.getIdempotencyKey()); diff --git a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/resource/BasePaymentResource.java b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/resource/BasePaymentResource.java index 7c5c301..59aef55 100644 --- a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/resource/BasePaymentResource.java +++ b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/resource/BasePaymentResource.java @@ -4,14 +4,16 @@ import io.smallrye.mutiny.Uni; import it.gov.pagopa.swclient.mil.bean.Errors; import it.gov.pagopa.swclient.mil.paymentnotice.ErrorCode; +import it.gov.pagopa.swclient.mil.paymentnotice.client.MilRestService; import it.gov.pagopa.swclient.mil.paymentnotice.client.NodeForPspWrapper; -import it.gov.pagopa.swclient.mil.paymentnotice.dao.PspConfRepository; -import it.gov.pagopa.swclient.mil.paymentnotice.dao.PspConfiguration; +import it.gov.pagopa.swclient.mil.paymentnotice.client.bean.PspConfiguration; import it.gov.pagopa.swclient.mil.paymentnotice.utils.NodeErrorMapping; +import it.gov.pagopa.swclient.mil.paymentnotice.utils.NodeApi; +import org.eclipse.microprofile.rest.client.inject.RestClient; +import org.jboss.resteasy.reactive.ClientWebApplicationException; import javax.inject.Inject; import javax.ws.rs.InternalServerErrorException; -import javax.ws.rs.NotFoundException; import javax.ws.rs.core.Response; import java.util.List; import java.util.stream.Collectors; @@ -20,45 +22,56 @@ public class BasePaymentResource { /** - * The configuration object cotaining the mapping between + * The configuration object containing the mapping between */ @Inject NodeErrorMapping nodeErrorMapping; + /** + * The async wrapper for the Node SOAP client + */ @Inject NodeForPspWrapper nodeWrapper; - - @Inject - PspConfRepository pspConfRepository; + + /** + * The reactive REST client for the MIL REST interfaces + */ + @RestClient + MilRestService milRestService; /** - * Retrieves the PSP configuration from the database by acquirer id, and emits it as a Uni + * Retrieves the PSP configuration by acquirer id, and emits it as a Uni * + * @param requestId the id of the request passed in request * @param acquirerId the id of the acquirer + * @param api a {@link NodeApi} used to choose which of the two PspConfiguration return * @return the {@link Uni} emitting a {@link PspConfiguration} */ - protected Uni retrievePSPConfiguration(String acquirerId) { - Log.debugf("retrievePSPConfiguration - acquirerId: %s ", acquirerId); + protected Uni retrievePSPConfiguration(String requestId, String acquirerId, NodeApi api) { + Log.debugf("retrievePSPConfiguration - requestId: %s acquirerId: %s ", requestId, acquirerId); - return pspConfRepository.findByIdOptional(acquirerId) - .onFailure().transform(t -> { - Log.errorf(t, "[%s] Error retrieving data from the db", ErrorCode.ERROR_RETRIEVING_DATA_FROM_MONGO); - return new InternalServerErrorException(Response - .status(Response.Status.INTERNAL_SERVER_ERROR) - .entity(new Errors(List.of(ErrorCode.ERROR_RETRIEVING_DATA_FROM_MONGO))) - .build()); - }) - .onItem().transform(o -> o.orElseThrow(NotFoundException::new)) + return milRestService.getPspConfiguration(requestId, acquirerId) .onFailure().transform(t -> { - Log.errorf(t, "[%s] Error retrieving data from the db", ErrorCode.UNKNOWN_ACQUIRER_ID); - return new InternalServerErrorException(Response - .status(Response.Status.INTERNAL_SERVER_ERROR) - .entity(new Errors(List.of(ErrorCode.UNKNOWN_ACQUIRER_ID))) - .build()); + if (t instanceof ClientWebApplicationException webEx && webEx.getResponse().getStatus() == 404) { + Log.errorf(t, "[%s] Missing psp configuration for acquirerId", ErrorCode.UNKNOWN_ACQUIRER_ID); + return new InternalServerErrorException(Response + .status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(new Errors(List.of(ErrorCode.UNKNOWN_ACQUIRER_ID))) + .build()); + } + else { + Log.errorf(t, "[%s] Error retrieving the psp configuration", ErrorCode.ERROR_CALLING_MIL_REST_SERVICES); + return new InternalServerErrorException(Response + .status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(new Errors(List.of(ErrorCode.ERROR_CALLING_MIL_REST_SERVICES))) + .build()); + } }) - .map(t -> t.pspConfiguration); - + .map(acquirerConfiguration -> switch (api) { + case ACTIVATE, VERIFY -> acquirerConfiguration.getPspConfigForVerifyAndActivate(); + case CLOSE -> acquirerConfiguration.getPspConfigForGetFeeAndClosePayment(); + }); } @@ -74,7 +87,7 @@ protected String remapNodeFaultToOutcome(String faultCode, String originalFaultC Integer outcomeErrorId = nodeErrorMapping.map(). get(Stream.of(faultCode, originalFaultCode) .filter(s -> s != null && !s.isEmpty()) - .collect(Collectors.joining(","))); + .collect(Collectors.joining("-"))); if (outcomeErrorId == null) { Log.errorf("Could not find configured mapping for faultCode %s originalFaultCode %s, defaulting to UNEXPECTED_ERROR", faultCode, originalFaultCode); diff --git a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/resource/PaymentResource.java b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/resource/PaymentResource.java index 61abd22..989fd0b 100644 --- a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/resource/PaymentResource.java +++ b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/resource/PaymentResource.java @@ -31,7 +31,9 @@ import it.gov.pagopa.swclient.mil.paymentnotice.bean.VerifyPaymentNoticeResponse; import it.gov.pagopa.swclient.mil.paymentnotice.client.bean.AdditionalPaymentInformations; import it.gov.pagopa.swclient.mil.paymentnotice.client.bean.NodeClosePaymentRequest; +import it.gov.pagopa.swclient.mil.paymentnotice.client.bean.PspConfiguration; import it.gov.pagopa.swclient.mil.paymentnotice.redis.PaymentService; +import it.gov.pagopa.swclient.mil.paymentnotice.utils.NodeApi; import org.apache.commons.lang3.exception.ExceptionUtils; import org.eclipse.microprofile.config.inject.ConfigProperty; import org.eclipse.microprofile.rest.client.inject.RestClient; @@ -46,7 +48,6 @@ import it.gov.pagopa.swclient.mil.paymentnotice.bean.Outcome; import it.gov.pagopa.swclient.mil.paymentnotice.bean.ReceivePaymentStatusRequest; import it.gov.pagopa.swclient.mil.paymentnotice.bean.ClosePaymentRequest; -import it.gov.pagopa.swclient.mil.paymentnotice.dao.PspConfiguration; import it.gov.pagopa.swclient.mil.paymentnotice.client.NodeRestService; import org.jboss.resteasy.reactive.ClientWebApplicationException; @@ -103,7 +104,7 @@ public Uni closePayment(@Valid @BeanParam CommonHeader headers, @Valid Log.debugf("closePayment - Input parameters: %s, body: %s", headers, closePaymentRequest); - return retrievePSPConfiguration(headers.getAcquirerId()) + return retrievePSPConfiguration(headers.getRequestId(), headers.getAcquirerId(), NodeApi.CLOSE) .chain(pspConf -> { if (Outcome.OK.name().equals(closePaymentRequest.getOutcome())) { return paymentService.setIfNotExist(closePaymentRequest.getTransactionId(), new ReceivePaymentStatusRequest()). @@ -302,7 +303,7 @@ private boolean validateClosePaymentError(ClientWebApplicationException webEx) { else { int nodeResponseStatus = webEx.getResponse().getStatus(); // for these three statuses we return outcome ko - if (nodeResponseStatus == 400 || nodeResponseStatus == 404 || nodeResponseStatus == 422) { + if (nodeResponseStatus == 400 || nodeResponseStatus == 404) { Log.debugf("Node closePayment returned a %s status response, responding with outcome KO", nodeResponseStatus); } else {// for any other status we return outcome ok @@ -328,9 +329,9 @@ private NodeClosePaymentRequest createNodeClosePaymentRequest(ClosePaymentReques nodeClosePaymentRequest.setPaymentTokens(closePaymentRequest.getPaymentTokens()); nodeClosePaymentRequest.setOutcome(closePaymentRequest.getOutcome()); - nodeClosePaymentRequest.setIdPsp(pspConfiguration.getPspId()); - nodeClosePaymentRequest.setIdBrokerPSP(pspConfiguration.getPspBroker()); - nodeClosePaymentRequest.setIdChannel(pspConfiguration.getIdChannel()); + nodeClosePaymentRequest.setIdPsp(pspConfiguration.getPsp()); + nodeClosePaymentRequest.setIdBrokerPSP(pspConfiguration.getBroker()); + nodeClosePaymentRequest.setIdChannel(pspConfiguration.getChannel()); nodeClosePaymentRequest.setPaymentMethod(closePaymentRequest.getPaymentMethod()); nodeClosePaymentRequest.setTransactionId(closePaymentRequest.getTransactionId()); // conversion from euro cents to euro diff --git a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/resource/VerifyPaymentNoticeResource.java b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/resource/VerifyPaymentNoticeResource.java index 49cf078..2fe2662 100644 --- a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/resource/VerifyPaymentNoticeResource.java +++ b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/resource/VerifyPaymentNoticeResource.java @@ -25,9 +25,10 @@ import it.gov.pagopa.swclient.mil.bean.CommonHeader; import it.gov.pagopa.swclient.mil.bean.Errors; import it.gov.pagopa.swclient.mil.paymentnotice.ErrorCode; -import it.gov.pagopa.swclient.mil.paymentnotice.dao.PspConfiguration; import it.gov.pagopa.swclient.mil.paymentnotice.bean.VerifyPaymentNoticeResponse; +import it.gov.pagopa.swclient.mil.paymentnotice.client.bean.PspConfiguration; import it.gov.pagopa.swclient.mil.paymentnotice.utils.NodeForPspLoggingUtil; +import it.gov.pagopa.swclient.mil.paymentnotice.utils.NodeApi; import it.gov.pagopa.swclient.mil.paymentnotice.utils.PaymentNoticeConstants; import it.gov.pagopa.swclient.mil.paymentnotice.utils.QrCode; @@ -54,7 +55,7 @@ public Uni verifyByQrCode(@Valid @BeanParam CommonHeader headers, // parse qr-code to retrieve the notice number and the PA tax code QrCode parsedQrCode = QrCode.parse(qrCode); - return retrievePSPConfiguration(headers.getAcquirerId()). + return retrievePSPConfiguration(headers.getRequestId(), headers.getAcquirerId(), NodeApi.VERIFY). chain(pspConf -> callNodeVerifyPaymentNotice(parsedQrCode.getPaTaxCode(), parsedQrCode.getNoticeNumber(), pspConf)); } @@ -81,7 +82,7 @@ public Uni verifyByTaxCodeAndNoticeNumber(@Valid @BeanParam CommonHead Log.debugf("verifyByTaxCodeAndNoticeNumber - Input parameters: %s, paTaxCode: %s, noticeNumber", headers, paTaxCode, noticeNumber); - return retrievePSPConfiguration(headers.getAcquirerId()). + return retrievePSPConfiguration(headers.getRequestId(), headers.getAcquirerId(), NodeApi.VERIFY). chain(pspConf -> callNodeVerifyPaymentNotice(paTaxCode, noticeNumber, pspConf)); } @@ -103,10 +104,10 @@ private Uni callNodeVerifyPaymentNotice(String paTaxCode, String notic VerifyPaymentNoticeReq verifyPaymentNoticeReq = new VerifyPaymentNoticeReq(); - verifyPaymentNoticeReq.setIdPSP(pspConfiguration.getPspId()); - verifyPaymentNoticeReq.setIdBrokerPSP(pspConfiguration.getPspBroker()); - verifyPaymentNoticeReq.setIdChannel(pspConfiguration.getIdChannel()); - verifyPaymentNoticeReq.setPassword(pspConfiguration.getPspPassword()); + verifyPaymentNoticeReq.setIdPSP(pspConfiguration.getPsp()); + verifyPaymentNoticeReq.setIdBrokerPSP(pspConfiguration.getBroker()); + verifyPaymentNoticeReq.setIdChannel(pspConfiguration.getChannel()); + verifyPaymentNoticeReq.setPassword(pspConfiguration.getPassword()); verifyPaymentNoticeReq.setQrCode(ctQrCode); diff --git a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/utils/NodeApi.java b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/utils/NodeApi.java new file mode 100644 index 0000000..2b4a55e --- /dev/null +++ b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/utils/NodeApi.java @@ -0,0 +1,9 @@ +package it.gov.pagopa.swclient.mil.paymentnotice.utils; + +public enum NodeApi { + + VERIFY, + ACTIVATE, + CLOSE + +} diff --git a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/utils/QrCode.java b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/utils/QrCode.java index 870f202..3eadc77 100644 --- a/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/utils/QrCode.java +++ b/src/main/java/it/gov/pagopa/swclient/mil/paymentnotice/utils/QrCode.java @@ -3,7 +3,6 @@ import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; -import javax.validation.Valid; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; @@ -62,7 +61,6 @@ private QrCode() { * @param qrCode the string representation of the QR code * @return the {@link QrCode} instance */ - @Valid public static QrCode parse(String qrCode) { QrCode instance = new QrCode(); String[] parts = StringUtils.split(qrCode, "|"); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index d20135c..26e410f 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -78,7 +78,9 @@ quarkus.cxf.client."nodo".service-interface=it.gov.pagopa.pagopa_api.nodeforpsp. # Quarkus reactive Redis client configuration # ------------------------------------------------------------------------------ -%dev.quarkus.redis.hosts=redis://localhost:6379 +#%dev.quarkus.redis.hosts=redis://:0VB6G2yFLtHwRhUgccGNJxFs2bgFFrCwJAzCaD8Vi2U=@mil-d-redis.redis.cache.windows.net:6380 +%dev.quarkus.redis.hosts=rediss://:wCou42NVkv7H@localhost:6379 +%dev.quarkus.redis.tls.trust-all=true %test.quarkus.redis.hosts=redis://localhost:6379 %prod.quarkus.redis.hosts=${redis-connection-string} @@ -94,6 +96,18 @@ quarkus.cxf.client."nodo".service-interface=it.gov.pagopa.pagopa_api.nodeforpsp. %test.node-rest-client.apim-subscription-key=abc %prod.node-rest-client.apim-subscription-key=${node-rest-client-subscription-key} +%dev.quarkus.rest-client.mil-rest-api.url=https://mil-d-apim.azure-api.net +%test.quarkus.rest-client.mil-rest-api.url=http://localhost:8088 +%prod.quarkus.rest-client.mil-rest-api.url=${mil.rest-service.url} + +%dev.mil-rest-client.apim-subscription-key=abc +%test.mil-rest-client.apim-subscription-key=abc +%prod.mil-rest-client.apim-subscription-key=${mil-rest-client-subscription-key} + +%dev.mil-rest-client.mil-acquirer-conf.version=1.0.0 +%test.mil-rest-client.mil-acquirer-conf.version=1.0.0 +%prod.mil-rest-client.mil-acquirer-conf.version=${mil-acquirer-conf-version} + %dev.quarkus.rest-client.connect-timeout=2000 %dev.quarkus.rest-client.read-timeout=2000 @@ -103,6 +117,8 @@ quarkus.cxf.client."nodo".service-interface=it.gov.pagopa.pagopa_api.nodeforpsp. %prod.quarkus.rest-client.connect-timeout=${paymentnotice.rest-client.connect-timeout} %prod.quarkus.rest-client.read-timeout=${paymentnotice.rest-client.read-timeout} + + # ------------------------------------------------------------------------------ # Service configurations # ------------------------------------------------------------------------------ @@ -132,6 +148,7 @@ node.error.outcomes[4]=PAYMENT_ALREADY_IN_PROGRESS node.error.outcomes[5]=EXPIRED_NOTICE node.error.outcomes[6]=REVOKED_NOTICE node.error.outcomes[7]=NOTICE_ALREADY_PAID +node.error.outcomes[8]=UNKNOWN_NOTICE node.error.map.PPT_SINTASSI_EXTRAXSD=2 node.error.map.PPT_PSP_SCONOSCIUTO=1 @@ -157,7 +174,7 @@ node.error.map.PPT_ERRORE_IDEMPOTENZA=0 node.error.map.PPT_STAZIONE_INT_PA_IRRAGGIUNGIBILE=3 node.error.map.PPT_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO=0 node.error.map.PPT_STAZIONE_INT_PA_TIMEOUT=3 -node.error.map.PPT_ERRORE_EMESSO_DA_PAA-PAA_PAGAMENTO_SCONOSCIUTO=2 +node.error.map.PPT_ERRORE_EMESSO_DA_PAA-PAA_PAGAMENTO_SCONOSCIUTO=8 node.error.map.PPT_ERRORE_EMESSO_DA_PAA-PAA_PAGAMENTO_SCADUTO=5 node.error.map.PPT_ERRORE_EMESSO_DA_PAA-PAA_PAGAMENTO_ANNULLATO=6 node.error.map.PPT_ERRORE_EMESSO_DA_PAA=3 diff --git a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/ActivatePaymentNoticeResourceTest.java b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/ActivatePaymentNoticeResourceTest.java index a09654e..251c2a4 100644 --- a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/ActivatePaymentNoticeResourceTest.java +++ b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/ActivatePaymentNoticeResourceTest.java @@ -1,22 +1,5 @@ package it.gov.pagopa.swclient.mil.paymentnotice; -import static io.restassured.RestAssured.given; - -import java.math.BigDecimal; -import java.text.ParseException; -import java.util.Optional; - -import javax.xml.datatype.DatatypeConfigurationException; - -import it.gov.pagopa.pagopa_api.xsd.common_types.v1_0.CtFaultBean; -import it.gov.pagopa.swclient.mil.paymentnotice.bean.Transfer; -import org.apache.commons.lang3.StringUtils; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestInstance; -import org.mockito.Mockito; - import io.quarkus.test.common.http.TestHTTPEndpoint; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.mockito.InjectMock; @@ -26,54 +9,83 @@ import it.gov.pagopa.pagopa_api.node.nodeforpsp.ActivatePaymentNoticeV2Response; import it.gov.pagopa.pagopa_api.node.nodeforpsp.CtTransferListPSPV2; import it.gov.pagopa.pagopa_api.node.nodeforpsp.CtTransferPSPV2; +import it.gov.pagopa.pagopa_api.xsd.common_types.v1_0.CtFaultBean; import it.gov.pagopa.pagopa_api.xsd.common_types.v1_0.StOutcome; import it.gov.pagopa.swclient.mil.paymentnotice.bean.ActivatePaymentNoticeRequest; import it.gov.pagopa.swclient.mil.paymentnotice.bean.Outcome; -import it.gov.pagopa.swclient.mil.paymentnotice.dao.PspConfiguration; -import it.gov.pagopa.swclient.mil.paymentnotice.dao.PspConfEntity; -import it.gov.pagopa.swclient.mil.paymentnotice.dao.PspConfRepository; -import it.gov.pagopa.swclient.mil.paymentnotice.resource.ActivatePaymentNoticeResource; +import it.gov.pagopa.swclient.mil.paymentnotice.bean.Transfer; +import it.gov.pagopa.swclient.mil.paymentnotice.client.MilRestService; import it.gov.pagopa.swclient.mil.paymentnotice.client.NodeForPspWrapper; +import it.gov.pagopa.swclient.mil.paymentnotice.client.bean.AcquirerConfiguration; +import it.gov.pagopa.swclient.mil.paymentnotice.client.bean.PspConfiguration; +import it.gov.pagopa.swclient.mil.paymentnotice.resource.ActivatePaymentNoticeResource; +import it.gov.pagopa.swclient.mil.paymentnotice.util.ExceptionType; +import it.gov.pagopa.swclient.mil.paymentnotice.util.TestUtils; +import org.apache.commons.lang3.StringUtils; +import org.eclipse.microprofile.rest.client.inject.RestClient; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.CsvFileSource; +import org.junit.jupiter.params.provider.MethodSource; +import org.mockito.Mockito; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Stream; + +import static io.restassured.RestAssured.given; @QuarkusTest @TestHTTPEndpoint(ActivatePaymentNoticeResource.class) @TestInstance(TestInstance.Lifecycle.PER_CLASS) class ActivatePaymentNoticeResourceTest { - - final static String SESSION_ID = "a6a666e6-97da-4848-b568-99fedccb642c"; - final static String API_VERSION = "1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay"; - - final static String QR_CODE = "qrCode"; - final static String PAX_CODE = "paxCode"; - final static String NOTICE_NUMBER = "noticeNumber"; - @InjectMock NodeForPspWrapper pnWrapper; - - @InjectMock - PspConfRepository pspConfRepository; - PspConfEntity pspConfEntity; + @InjectMock + @RestClient + MilRestService milRestService; ActivatePaymentNoticeV2Response nodeActivateResponseOk; - ActivatePaymentNoticeV2Response nodeActivateResponseKo; + AcquirerConfiguration acquirerConfiguration; + + Map commonHeaders; + @BeforeAll void createTestObjects() { - // PSP configuration - PspConfiguration pspInfo = new PspConfiguration(); - pspInfo.setPspId("AGID_01"); - pspInfo.setPspBroker("97735020584"); - pspInfo.setPspPassword("pwd_AgID"); + // common headers + commonHeaders = new HashMap<>(); + commonHeaders.put("RequestId", UUID.randomUUID().toString()); + commonHeaders.put("Version", "1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay"); + commonHeaders.put("AcquirerId", "4585625"); + commonHeaders.put("Channel", "ATM"); + commonHeaders.put("TerminalId", "0aB9wXyZ"); + commonHeaders.put("SessionId", UUID.randomUUID().toString()); - pspConfEntity = new PspConfEntity(); - pspConfEntity.acquirerId = "4585625"; - pspConfEntity.pspConfiguration = pspInfo; - // node verify response OK + // acquirer PSP configuration + acquirerConfiguration = new AcquirerConfiguration(); + + PspConfiguration pspConfiguration = new PspConfiguration(); + pspConfiguration.setPsp("AGID_01"); + pspConfiguration.setBroker("97735020584"); + pspConfiguration.setChannel("97735020584_07"); + pspConfiguration.setPassword("PLACEHOLDER"); + + acquirerConfiguration.setPspConfigForVerifyAndActivate(pspConfiguration); + acquirerConfiguration.setPspConfigForGetFeeAndClosePayment(pspConfiguration); + + // node activate response OK // // OK @@ -97,7 +109,7 @@ void createTestObjects() { CtTransferPSPV2 transfer1 = new CtTransferPSPV2(); transfer1.setIdTransfer(1); - transfer1.setTransferAmount(new BigDecimal(99.98)); + transfer1.setTransferAmount(new BigDecimal("99.98")); transfer1.setFiscalCodePA("77777777777"); transfer1.setIBAN("IT30N0103076271000001823603"); transfer1.setRemittanceInformation("TARI Comune EC_TE"); @@ -105,7 +117,7 @@ void createTestObjects() { CtTransferPSPV2 transfer2 = new CtTransferPSPV2(); transfer2.setIdTransfer(1); - transfer2.setTransferAmount(new BigDecimal(1.01)); + transfer2.setTransferAmount(new BigDecimal("1.01")); transfer2.setFiscalCodePA("77777777777"); transfer2.setIBAN("IT30N0103076271000001823603"); transfer2.setRemittanceInformation("TARI Comune EC_TE"); @@ -126,9 +138,13 @@ void createTestObjects() { nodeActivateResponseOk.setTransferList(transferList); nodeActivateResponseOk.setCreditorReferenceId("02051234567890124"); + } + + private ActivatePaymentNoticeV2Response generateKoNodeResponse(String faultCode, String originalFaultCode) { + // node verify response KO - // + // // KO // // PPT_SINTASSI_EXTRAXSD @@ -138,21 +154,36 @@ void createTestObjects() { // cvc-pattern-valid: il valore "30205" non è valido come facet rispetto al pattern "[0-9]{18}" per il tipo 'stNoticeNumber'. // // - // + // CtFaultBean ctFaultBean = new CtFaultBean(); - ctFaultBean.setFaultCode("PPT_SINTASSI_EXTRAXSD"); - ctFaultBean.setFaultString("Errore di sintassi extra XSD."); - ctFaultBean.setId("NodoDeiPagamentiSPC"); - ctFaultBean.setDescription( - "Errore validazione XML [Envelope/Body/verifyPaymentNoticeReq/qrCode/noticeNumber] - cvc-pattern-valid: il valore \"30205\" " + - "non è valido come facet rispetto al pattern \"[0-9]{18}\" per il tipo 'stNoticeNumber'." - ); + ctFaultBean.setFaultCode(faultCode); + ctFaultBean.setOriginalFaultCode(originalFaultCode); - nodeActivateResponseKo = new ActivatePaymentNoticeV2Response(); - nodeActivateResponseKo.setOutcome(StOutcome.KO); - nodeActivateResponseKo.setFault(ctFaultBean); + ActivatePaymentNoticeV2Response activatePaymentNoticeV2Response = new ActivatePaymentNoticeV2Response(); + activatePaymentNoticeV2Response.setOutcome(StOutcome.KO); + activatePaymentNoticeV2Response.setFault(ctFaultBean); + + return activatePaymentNoticeV2Response; + } + + private Stream provideNodeIntegrationErrorCases() { + return Stream.of( + Arguments.of(ExceptionType.CLIENT_WEB_APPLICATION_EXCEPTION_400, ErrorCode.ERROR_CALLING_NODE_SOAP_SERVICES), + Arguments.of(ExceptionType.CLIENT_WEB_APPLICATION_EXCEPTION_500, ErrorCode.ERROR_CALLING_NODE_SOAP_SERVICES), + Arguments.of(ExceptionType.TIMEOUT_EXCEPTION, ErrorCode.ERROR_CALLING_NODE_SOAP_SERVICES), + Arguments.of(ExceptionType.UNPARSABLE_EXCEPTION, ErrorCode.ERROR_CALLING_NODE_SOAP_SERVICES) + ); + } + private Stream provideMilIntegrationErrorCases() { + return Stream.of( + Arguments.of(ExceptionType.CLIENT_WEB_APPLICATION_EXCEPTION_400, ErrorCode.ERROR_CALLING_MIL_REST_SERVICES), + Arguments.of(ExceptionType.CLIENT_WEB_APPLICATION_EXCEPTION_404, ErrorCode.UNKNOWN_ACQUIRER_ID), + Arguments.of(ExceptionType.CLIENT_WEB_APPLICATION_EXCEPTION_500, ErrorCode.ERROR_CALLING_MIL_REST_SERVICES), + Arguments.of(ExceptionType.TIMEOUT_EXCEPTION, ErrorCode.ERROR_CALLING_MIL_REST_SERVICES), + Arguments.of(ExceptionType.UNPARSABLE_EXCEPTION, ErrorCode.ERROR_CALLING_MIL_REST_SERVICES) + ); } @@ -160,8 +191,8 @@ void createTestObjects() { void testActivateByQrCode_200_nodeOk() { Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.of(pspConfEntity))); + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); Mockito .when(pnWrapper.activatePaymentNoticeV2Async(Mockito.any())) @@ -173,15 +204,9 @@ void testActivateByQrCode_200_nodeOk() { Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() - .pathParam(QR_CODE, "PAGOPA|002|100000000000000000|20000000000|9999") + .pathParam("qrCode", "PAGOPA|002|100000000000000000|20000000000|9999") .body(activateRequest) .when() .patch("/{qrCode}") @@ -204,17 +229,18 @@ void testActivateByQrCode_200_nodeOk() { Assertions.assertEquals(StringUtils.EMPTY, response.jsonPath().getList("transfers", Transfer.class).get(1).getCategory()); } - - @Test - void testActivateByQrCode_200_nodeKo() { + + @ParameterizedTest + @CsvFileSource(resources = "/node_error_mapping.csv", numLinesToSkip = 1) + void testActivateByQrCode_200_nodeKo(String faultCode, String originalFaultCode, String milOutcome) { Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.of(pspConfEntity))); + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); Mockito .when(pnWrapper.activatePaymentNoticeV2Async(Mockito.any())) - .thenReturn(Uni.createFrom().item(nodeActivateResponseKo)); + .thenReturn(Uni.createFrom().item(generateKoNodeResponse(faultCode, originalFaultCode))); ActivatePaymentNoticeRequest activateRequest = new ActivatePaymentNoticeRequest(); activateRequest.setAmount(10099L); @@ -223,15 +249,9 @@ void testActivateByQrCode_200_nodeKo() { Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() - .pathParam(QR_CODE, "PAGOPA|002|100000000000000000|20000000000|9999") + .pathParam("qrCode", "PAGOPA|002|100000000000000000|20000000000|9999") .body(activateRequest) .when() .patch("/{qrCode}") @@ -241,19 +261,58 @@ void testActivateByQrCode_200_nodeKo() { Assertions.assertEquals(200, response.statusCode()); Assertions.assertNull(response.jsonPath().getJsonObject("errors")); - Assertions.assertEquals("WRONG_NOTICE_DATA", response.jsonPath().getString("outcome")); + Assertions.assertEquals(milOutcome, response.jsonPath().getString("outcome")); Assertions.assertNull(response.jsonPath().getJsonObject("amount")); Assertions.assertNull(response.jsonPath().getJsonObject("paTaxCode")); Assertions.assertNull(response.jsonPath().getJsonObject("transfers")); } - @Test - void testActivateByQrCode_500_pspInfoNotFound() { + + @ParameterizedTest + @MethodSource("provideNodeIntegrationErrorCases") + void testActivateByQrCode_500_nodeError(ExceptionType exceptionType, String errorCode) { + + Mockito + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.empty())); + .when(pnWrapper.activatePaymentNoticeV2Async(Mockito.any())) + .thenReturn(Uni.createFrom().failure(TestUtils.getException(exceptionType))); + + ActivatePaymentNoticeRequest activateRequest = new ActivatePaymentNoticeRequest(); + activateRequest.setAmount(10099L); + activateRequest.setIdempotencyKey("77777777777_abcDEF1238"); + + Response response = given() + .contentType(ContentType.JSON) + .headers(commonHeaders) + .and() + .pathParam("qrCode", "PAGOPA|002|100000000000000000|20000000000|9999") + .body(activateRequest) + .when() + .patch("/{qrCode}") + .then() + .extract() + .response(); + + Assertions.assertEquals(500, response.statusCode()); + Assertions.assertTrue(response.jsonPath().getList("errors").contains(errorCode)); + Assertions.assertNull(response.jsonPath().getJsonObject("outcome")); + Assertions.assertNull(response.jsonPath().getJsonObject("amount")); + Assertions.assertNull(response.jsonPath().getJsonObject("paTaxCode")); + Assertions.assertNull(response.jsonPath().getJsonObject("transfers")); + + } + + @ParameterizedTest + @MethodSource("provideMilIntegrationErrorCases") + void testActivateByQrCode__500_milError(ExceptionType exceptionType, String errorCode) { + + Mockito + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().failure(TestUtils.getException(exceptionType))); ActivatePaymentNoticeRequest activateRequest = new ActivatePaymentNoticeRequest(); activateRequest.setAmount(10099L); @@ -261,15 +320,9 @@ void testActivateByQrCode_500_pspInfoNotFound() { Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() - .pathParam(QR_CODE, "PAGOPA|002|100000000000000000|20000000000|9999") + .pathParam("qrCode", "PAGOPA|002|100000000000000000|20000000000|9999") .body(activateRequest) .when() .patch("/{qrCode}") @@ -278,7 +331,7 @@ void testActivateByQrCode_500_pspInfoNotFound() { .response(); Assertions.assertEquals(500, response.statusCode()); - Assertions.assertTrue(response.jsonPath().getList("errors").contains(ErrorCode.UNKNOWN_ACQUIRER_ID)); + Assertions.assertTrue(response.jsonPath().getList("errors").contains(errorCode)); Assertions.assertNull(response.jsonPath().getJsonObject("outcome")); Assertions.assertNull(response.jsonPath().getJsonObject("amount")); Assertions.assertNull(response.jsonPath().getJsonObject("paTaxCode")); @@ -290,8 +343,8 @@ void testActivateByQrCode_500_pspInfoNotFound() { void testActivateByTaxCodeAndNoticeNumber_200_nodeOk() { Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.of(pspConfEntity))); + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); Mockito .when(pnWrapper.activatePaymentNoticeV2Async(Mockito.any())) @@ -303,19 +356,13 @@ void testActivateByTaxCodeAndNoticeNumber_200_nodeOk() { Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() - .pathParam(PAX_CODE, "20000000000") - .pathParam(NOTICE_NUMBER, "100000000000000000") + .pathParam("paTaxCode", "20000000000") + .pathParam("noticeNumber", "100000000000000000") .body(activateRequest) .when() - .patch("/{"+ PAX_CODE + "}/{" + NOTICE_NUMBER + "}") + .patch("/{paTaxCode}/{noticeNumber}") .then() .extract() .response(); @@ -336,16 +383,17 @@ void testActivateByTaxCodeAndNoticeNumber_200_nodeOk() { } - @Test - void testActivateByTaxCodeAndNoticeNumber_200_nodeKo() { + @ParameterizedTest + @CsvFileSource(resources = "/node_error_mapping.csv", numLinesToSkip = 1) + void testActivateByTaxCodeAndNoticeNumber_200_nodeKo(String faultCode, String originalFaultCode, String milOutcome) { Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.of(pspConfEntity))); + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); Mockito .when(pnWrapper.activatePaymentNoticeV2Async(Mockito.any())) - .thenReturn(Uni.createFrom().item(nodeActivateResponseKo)); + .thenReturn(Uni.createFrom().item(generateKoNodeResponse(faultCode, originalFaultCode))); ActivatePaymentNoticeRequest activateRequest = new ActivatePaymentNoticeRequest(); activateRequest.setAmount(10099L); @@ -353,38 +401,70 @@ void testActivateByTaxCodeAndNoticeNumber_200_nodeKo() { Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() - .pathParam(PAX_CODE, "20000000000") - .pathParam(NOTICE_NUMBER, "100000000000000000") + .pathParam("paTaxCode", "20000000000") + .pathParam("noticeNumber", "100000000000000000") .body(activateRequest) .when() - .patch("/{"+ PAX_CODE + "}/{" + NOTICE_NUMBER + "}") + .patch("/{paTaxCode}/{noticeNumber}") .then() .extract() .response(); Assertions.assertEquals(200, response.statusCode()); Assertions.assertNull(response.jsonPath().getJsonObject("errors")); - Assertions.assertEquals("WRONG_NOTICE_DATA", response.jsonPath().getString("outcome")); + Assertions.assertEquals(milOutcome, response.jsonPath().getString("outcome")); Assertions.assertNull(response.jsonPath().getJsonObject("amount")); Assertions.assertNull(response.jsonPath().getJsonObject("paTaxCode")); Assertions.assertNull(response.jsonPath().getJsonObject("transfers")); } - - @Test - void testActivateByTaxCodeAndNoticeNumber_500_pspInfoNotFound() { + + @ParameterizedTest + @MethodSource("provideNodeIntegrationErrorCases") + void testActivateByTaxCodeAndNoticeNumber_500_nodeError(ExceptionType exceptionType, String errorCode) { + + Mockito + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); + + Mockito + .when(pnWrapper.activatePaymentNoticeV2Async(Mockito.any())) + .thenReturn(Uni.createFrom().failure(TestUtils.getException(exceptionType))); + + ActivatePaymentNoticeRequest activateRequest = new ActivatePaymentNoticeRequest(); + activateRequest.setAmount(10099L); + activateRequest.setIdempotencyKey("77777777777_abcDEF1238"); + + Response response = given() + .contentType(ContentType.JSON) + .headers(commonHeaders) + .and() + .pathParam("paTaxCode", "20000000000") + .pathParam("noticeNumber", "100000000000000000") + .body(activateRequest) + .when() + .patch("/{paTaxCode}/{noticeNumber}") + .then() + .extract() + .response(); + + Assertions.assertEquals(500, response.statusCode()); + Assertions.assertTrue(response.jsonPath().getList("errors").contains(errorCode)); + Assertions.assertNull(response.jsonPath().getJsonObject("outcome")); + Assertions.assertNull(response.jsonPath().getJsonObject("amount")); + Assertions.assertNull(response.jsonPath().getJsonObject("paTaxCode")); + Assertions.assertNull(response.jsonPath().getJsonObject("transfers")); + } + + @ParameterizedTest + @MethodSource("provideMilIntegrationErrorCases") + void testActivateByTaxCodeAndNoticeNumber_500_milError(ExceptionType exceptionType, String errorCode) { Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.empty())); + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().failure(TestUtils.getException(exceptionType))); ActivatePaymentNoticeRequest activateRequest = new ActivatePaymentNoticeRequest(); activateRequest.setAmount(10099L); @@ -392,25 +472,19 @@ void testActivateByTaxCodeAndNoticeNumber_500_pspInfoNotFound() { Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() - .pathParam(PAX_CODE, "20000000000") - .pathParam(NOTICE_NUMBER, "100000000000000000") + .pathParam("paTaxCode", "20000000000") + .pathParam("noticeNumber", "100000000000000000") .body(activateRequest) .when() - .patch("/{"+ PAX_CODE + "}/{" + NOTICE_NUMBER + "}") + .patch("/{paTaxCode}/{noticeNumber}") .then() .extract() .response(); Assertions.assertEquals(500, response.statusCode()); - Assertions.assertTrue(response.jsonPath().getList("errors").contains(ErrorCode.UNKNOWN_ACQUIRER_ID)); + Assertions.assertTrue(response.jsonPath().getList("errors").contains(errorCode)); Assertions.assertNull(response.jsonPath().getJsonObject("outcome")); Assertions.assertNull(response.jsonPath().getJsonObject("amount")); Assertions.assertNull(response.jsonPath().getJsonObject("paTaxCode")); diff --git a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/ClosePaymentResourceTest.java b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/ClosePaymentResourceTest.java index 53dda14..af7cf3c 100644 --- a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/ClosePaymentResourceTest.java +++ b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/ClosePaymentResourceTest.java @@ -1,16 +1,23 @@ package it.gov.pagopa.swclient.mil.paymentnotice; -import static io.restassured.RestAssured.given; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.concurrent.TimeoutException; - +import io.quarkus.test.common.http.TestHTTPEndpoint; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.mockito.InjectMock; +import io.restassured.http.ContentType; +import io.restassured.response.Response; +import io.smallrye.mutiny.Uni; +import it.gov.pagopa.swclient.mil.paymentnotice.bean.ClosePaymentRequest; +import it.gov.pagopa.swclient.mil.paymentnotice.bean.Outcome; +import it.gov.pagopa.swclient.mil.paymentnotice.client.MilRestService; +import it.gov.pagopa.swclient.mil.paymentnotice.client.NodeRestService; +import it.gov.pagopa.swclient.mil.paymentnotice.client.bean.AcquirerConfiguration; import it.gov.pagopa.swclient.mil.paymentnotice.client.bean.NodeClosePaymentRequest; import it.gov.pagopa.swclient.mil.paymentnotice.client.bean.NodeClosePaymentResponse; +import it.gov.pagopa.swclient.mil.paymentnotice.client.bean.PspConfiguration; import it.gov.pagopa.swclient.mil.paymentnotice.redis.PaymentService; +import it.gov.pagopa.swclient.mil.paymentnotice.resource.PaymentResource; +import it.gov.pagopa.swclient.mil.paymentnotice.util.ExceptionType; +import it.gov.pagopa.swclient.mil.paymentnotice.util.TestUtils; import org.eclipse.microprofile.rest.client.inject.RestClient; import org.jboss.resteasy.reactive.ClientWebApplicationException; import org.junit.jupiter.api.Assertions; @@ -18,59 +25,72 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.ValueSource; import org.mockito.Mockito; -import io.quarkus.test.common.http.TestHTTPEndpoint; -import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.mockito.InjectMock; -import io.restassured.http.ContentType; -import io.restassured.response.Response; -import io.smallrye.mutiny.Uni; -import it.gov.pagopa.swclient.mil.paymentnotice.bean.Outcome; -import it.gov.pagopa.swclient.mil.paymentnotice.bean.ClosePaymentRequest; -import it.gov.pagopa.swclient.mil.paymentnotice.dao.PspConfiguration; -import it.gov.pagopa.swclient.mil.paymentnotice.client.NodeRestService; -import it.gov.pagopa.swclient.mil.paymentnotice.dao.PspConfEntity; -import it.gov.pagopa.swclient.mil.paymentnotice.dao.PspConfRepository; -import it.gov.pagopa.swclient.mil.paymentnotice.resource.PaymentResource; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.TimeoutException; +import java.util.stream.Stream; + +import static io.restassured.RestAssured.given; @QuarkusTest @TestHTTPEndpoint(PaymentResource.class) @TestInstance(TestInstance.Lifecycle.PER_CLASS) class ClosePaymentResourceTest { - - final static String SESSION_ID = "a6a666e6-97da-4848-b568-99fedccb642c"; - final static String API_VERSION = "1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay"; - + @InjectMock @RestClient NodeRestService nodeRestService; @InjectMock - PspConfRepository pspConfRepository; + @RestClient + MilRestService milRestService; @InjectMock PaymentService paymentService; - PspConfEntity pspConfEntity; - ClosePaymentRequest closePaymentRequestOK; ClosePaymentRequest closePaymentRequestKO; + AcquirerConfiguration acquirerConfiguration; + + Map commonHeaders; + + @BeforeAll void createTestObjects() { - // PSP configuration - PspConfiguration pspInfo = new PspConfiguration(); - pspInfo.setPspId("AGID_01"); - pspInfo.setPspBroker("97735020584"); - pspInfo.setPspPassword("pwd_AgID"); + // common headers + commonHeaders = new HashMap<>(); + commonHeaders.put("RequestId", UUID.randomUUID().toString()); + commonHeaders.put("Version", "1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay"); + commonHeaders.put("AcquirerId", "4585625"); + commonHeaders.put("Channel", "ATM"); + commonHeaders.put("TerminalId", "0aB9wXyZ"); + commonHeaders.put("SessionId", UUID.randomUUID().toString()); + + + // acquirer PSP configuration + acquirerConfiguration = new AcquirerConfiguration(); + + it.gov.pagopa.swclient.mil.paymentnotice.client.bean.PspConfiguration pspConfiguration = new PspConfiguration(); + pspConfiguration.setPsp("AGID_01"); + pspConfiguration.setBroker("97735020584"); + pspConfiguration.setChannel("97735020584_07"); + pspConfiguration.setPassword("PLACEHOLDER"); + + acquirerConfiguration.setPspConfigForVerifyAndActivate(pspConfiguration); + acquirerConfiguration.setPspConfigForGetFeeAndClosePayment(pspConfiguration); - pspConfEntity = new PspConfEntity(); - pspConfEntity.acquirerId = "4585625"; - pspConfEntity.pspConfiguration = pspInfo; closePaymentRequestOK = new ClosePaymentRequest(); closePaymentRequestOK.setOutcome(Outcome.OK.toString()); @@ -92,15 +112,19 @@ void createTestObjects() { closePaymentRequestKO.setFee(BigInteger.valueOf(897)); closePaymentRequestKO.setTimestampOp("2022-11-12T08:53:55"); + } - // node close response OK - - - // node close response KO - - + private static Stream provideMilIntegrationErrorCases() { + return Stream.of( + Arguments.of(ExceptionType.CLIENT_WEB_APPLICATION_EXCEPTION_400, ErrorCode.ERROR_CALLING_MIL_REST_SERVICES), + Arguments.of(ExceptionType.CLIENT_WEB_APPLICATION_EXCEPTION_404, ErrorCode.UNKNOWN_ACQUIRER_ID), + Arguments.of(ExceptionType.CLIENT_WEB_APPLICATION_EXCEPTION_500, ErrorCode.ERROR_CALLING_MIL_REST_SERVICES), + Arguments.of(ExceptionType.TIMEOUT_EXCEPTION, ErrorCode.ERROR_CALLING_MIL_REST_SERVICES), + Arguments.of(ExceptionType.UNPARSABLE_EXCEPTION, ErrorCode.ERROR_CALLING_MIL_REST_SERVICES) + ); } + @Test void testClosePayment_200_node200_OK() { @@ -112,8 +136,8 @@ void testClosePayment_200_node200_OK() { nodeClosePaymentResponse.setOutcome(Outcome.OK.name()); Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.of(pspConfEntity))); + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); Mockito .when(nodeRestService.closePayment(Mockito.any())) @@ -122,13 +146,7 @@ void testClosePayment_200_node200_OK() { Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() .body(closePaymentRequestOK) .when() @@ -158,8 +176,8 @@ void testClosePayment_200_node200_KO() { nodeClosePaymentResponse.setOutcome(Outcome.KO.name()); Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.of(pspConfEntity))); + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); Mockito .when(nodeRestService.closePayment(Mockito.any())) @@ -168,13 +186,7 @@ void testClosePayment_200_node200_KO() { Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() .body(closePaymentRequestOK) .when() @@ -194,7 +206,7 @@ void testClosePayment_200_node200_KO() { @ParameterizedTest - @ValueSource(ints = {400, 404, 422}) + @ValueSource(ints = {400, 404}) void testClosePayment_200_nodeError_KO(int statusCode) { Mockito @@ -202,23 +214,17 @@ void testClosePayment_200_nodeError_KO(int statusCode) { .thenReturn(Uni.createFrom().voidItem()); Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.of(pspConfEntity))); + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); Mockito .when(nodeRestService.closePayment(Mockito.any())) - .thenReturn(Uni.createFrom().failure(() -> new ClientWebApplicationException(statusCode))); + .thenReturn(Uni.createFrom().failure(new ClientWebApplicationException(statusCode))); Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() .body(closePaymentRequestOK) .when() @@ -238,7 +244,7 @@ void testClosePayment_200_nodeError_KO(int statusCode) { @ParameterizedTest - @ValueSource(ints = {408, 500}) + @ValueSource(ints = {408, 422, 500}) void testClosePayment_200_nodeError_OK(int status) { Mockito @@ -246,8 +252,8 @@ void testClosePayment_200_nodeError_OK(int status) { .thenReturn(Uni.createFrom().voidItem()); Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.of(pspConfEntity))); + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); Mockito .when(nodeRestService.closePayment(Mockito.any())) @@ -256,13 +262,7 @@ void testClosePayment_200_nodeError_OK(int status) { Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() .body(closePaymentRequestOK) .when() @@ -290,8 +290,8 @@ void testClosePayment_200_nodeTimeout() { .thenReturn(Uni.createFrom().voidItem()); Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.of(pspConfEntity))); + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); Mockito .when(nodeRestService.closePayment(Mockito.any(NodeClosePaymentRequest.class))) @@ -300,13 +300,7 @@ void testClosePayment_200_nodeTimeout() { Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() .body(closePaymentRequestOK) .when() @@ -334,8 +328,8 @@ void testClosePaymentKO_200_nodeOK() { nodeClosePaymentResponse.setOutcome(Outcome.OK.name()); Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.of(pspConfEntity))); + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); Mockito .when(nodeRestService.closePayment(Mockito.any(NodeClosePaymentRequest.class))) @@ -344,13 +338,7 @@ void testClosePaymentKO_200_nodeOK() { Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() .body(closePaymentRequestKO) .when() @@ -362,5 +350,33 @@ void testClosePaymentKO_200_nodeOK() { Assertions.assertEquals(202, response.statusCode()); } + + @ParameterizedTest + @MethodSource("provideMilIntegrationErrorCases") + void testClosePayment_500_milError(ExceptionType exceptionType, String errorCode) { + + Mockito + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().failure(TestUtils.getException(exceptionType))); + + Response response = given() + .contentType(ContentType.JSON) + .headers(commonHeaders) + .and() + .body(closePaymentRequestOK) + .when() + .post("/") + .then() + .extract() + .response(); + + Assertions.assertEquals(500, response.statusCode()); + Assertions.assertTrue(response.jsonPath().getList("errors").contains(errorCode)); + Assertions.assertNull(response.jsonPath().getJsonObject("outcome")); + Assertions.assertNull(response.getHeader("Location")); + Assertions.assertNull(response.getHeader("Retry-after")); + Assertions.assertNull(response.getHeader("Max-Retry")); + + } } diff --git a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/SendPaymentResultTest.java b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/SendPaymentResultTest.java index 55d1413..01256c8 100644 --- a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/SendPaymentResultTest.java +++ b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/SendPaymentResultTest.java @@ -1,19 +1,5 @@ package it.gov.pagopa.swclient.mil.paymentnotice; -import static io.restassured.RestAssured.given; - -import java.util.ArrayList; -import java.util.List; - -import javax.ws.rs.InternalServerErrorException; - -import it.gov.pagopa.swclient.mil.paymentnotice.redis.PaymentService; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestInstance; -import org.mockito.Mockito; - import io.quarkus.test.common.http.TestHTTPEndpoint; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.mockito.InjectMock; @@ -21,17 +7,30 @@ import io.restassured.response.Response; import io.smallrye.mutiny.Uni; import it.gov.pagopa.swclient.mil.paymentnotice.bean.Outcome; -import it.gov.pagopa.swclient.mil.paymentnotice.bean.ReceivePaymentStatusRequest; import it.gov.pagopa.swclient.mil.paymentnotice.bean.Payment; +import it.gov.pagopa.swclient.mil.paymentnotice.bean.ReceivePaymentStatusRequest; +import it.gov.pagopa.swclient.mil.paymentnotice.redis.PaymentService; import it.gov.pagopa.swclient.mil.paymentnotice.resource.PaymentResource; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.mockito.Mockito; + +import javax.ws.rs.InternalServerErrorException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import static io.restassured.RestAssured.given; @QuarkusTest @TestHTTPEndpoint(PaymentResource.class) @TestInstance(TestInstance.Lifecycle.PER_CLASS) class SendPaymentResultTest { - - final static String SESSION_ID = "a6a666e6-97da-4848-b568-99fedccb642c"; - final static String API_VERSION = "1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay"; + final static String TRANSACTION_ID = "517a4216840E461fB011036A0fd134E1"; @InjectMock @@ -39,9 +38,20 @@ class SendPaymentResultTest { ReceivePaymentStatusRequest paymentStatus; + Map commonHeaders; + @BeforeAll void createTestObjects() { + // common headers + commonHeaders = new HashMap<>(); + commonHeaders.put("RequestId", UUID.randomUUID().toString()); + commonHeaders.put("Version", "1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay"); + commonHeaders.put("AcquirerId", "4585625"); + commonHeaders.put("Channel", "ATM"); + commonHeaders.put("TerminalId", "0aB9wXyZ"); + commonHeaders.put("SessionId", UUID.randomUUID().toString()); + Payment payment = new Payment(); payment.setCompany("ASL Roma"); payment.setCreditorReferenceId("4839d50603fssfW5X"); @@ -70,13 +80,7 @@ void testGetPaymentStatus_200() { Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() .pathParam("transactionId", TRANSACTION_ID) .when() @@ -112,13 +116,7 @@ void testGetPaymentStatus_404_transactionNotFound() { Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() .pathParam("transactionId", TRANSACTION_ID) .when() @@ -141,13 +139,7 @@ void testGetSendPaymentResult_500_RedisError() { Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() .pathParam("transactionId", TRANSACTION_ID) .when() @@ -177,13 +169,6 @@ void testReceivePaymentStatus_200() { Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) .and() .pathParam("transactionId", TRANSACTION_ID) .body(paymentStatus) @@ -211,13 +196,6 @@ void testReceivePaymentStatus_404() { Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) .and() .pathParam("transactionId", TRANSACTION_ID) .body(paymentStatus) @@ -237,18 +215,11 @@ void testReceivePaymentStatus_500_RedisErrorGet() { Mockito .when(paymentService.get(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().failure(() -> new RuntimeException())); + .thenReturn(Uni.createFrom().failure(new RuntimeException())); Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) .and() .pathParam("transactionId", TRANSACTION_ID) .when() @@ -272,18 +243,11 @@ void testReceivePaymentStatus_500_RedisError() { Mockito .when(paymentService.set(Mockito.any(String.class), Mockito.any())) - .thenReturn(Uni.createFrom().failure(() -> new RuntimeException())); + .thenReturn(Uni.createFrom().failure(new RuntimeException())); Response response = given() .contentType(ContentType.JSON) - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) .and() .pathParam("transactionId", TRANSACTION_ID) .when() diff --git a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/VerifyPaymentNoticeResourceTest.java b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/VerifyPaymentNoticeResourceTest.java index d1a52d0..34ea97d 100644 --- a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/VerifyPaymentNoticeResourceTest.java +++ b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/VerifyPaymentNoticeResourceTest.java @@ -1,87 +1,95 @@ package it.gov.pagopa.swclient.mil.paymentnotice; -import static io.restassured.RestAssured.given; - -import java.math.BigDecimal; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Stream; - -import javax.xml.datatype.DatatypeConfigurationException; -import javax.xml.datatype.DatatypeConstants; -import javax.xml.datatype.DatatypeFactory; -import javax.xml.datatype.XMLGregorianCalendar; - -import com.google.common.collect.Maps; +import io.quarkus.test.common.http.TestHTTPEndpoint; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.mockito.InjectMock; +import io.restassured.response.Response; +import io.smallrye.mutiny.Uni; +import it.gov.pagopa.pagopa_api.node.nodeforpsp.CtPaymentOptionDescription; +import it.gov.pagopa.pagopa_api.node.nodeforpsp.CtPaymentOptionsDescriptionList; import it.gov.pagopa.pagopa_api.node.nodeforpsp.StAmountOptionPSP; +import it.gov.pagopa.pagopa_api.node.nodeforpsp.VerifyPaymentNoticeRes; import it.gov.pagopa.pagopa_api.xsd.common_types.v1_0.CtFaultBean; +import it.gov.pagopa.pagopa_api.xsd.common_types.v1_0.StOutcome; +import it.gov.pagopa.swclient.mil.paymentnotice.bean.Outcome; +import it.gov.pagopa.swclient.mil.paymentnotice.client.MilRestService; +import it.gov.pagopa.swclient.mil.paymentnotice.client.NodeForPspWrapper; +import it.gov.pagopa.swclient.mil.paymentnotice.client.bean.AcquirerConfiguration; +import it.gov.pagopa.swclient.mil.paymentnotice.client.bean.PspConfiguration; import it.gov.pagopa.swclient.mil.paymentnotice.resource.VerifyPaymentNoticeResource; +import it.gov.pagopa.swclient.mil.paymentnotice.util.ExceptionType; +import it.gov.pagopa.swclient.mil.paymentnotice.util.TestUtils; +import org.eclipse.microprofile.rest.client.inject.RestClient; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.CsvFileSource; import org.junit.jupiter.params.provider.MethodSource; import org.mockito.Mockito; -import io.quarkus.test.common.http.TestHTTPEndpoint; -import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.mockito.InjectMock; -import io.restassured.response.Response; -import io.smallrye.mutiny.Uni; -import it.gov.pagopa.pagopa_api.node.nodeforpsp.CtPaymentOptionDescription; -import it.gov.pagopa.pagopa_api.node.nodeforpsp.CtPaymentOptionsDescriptionList; -import it.gov.pagopa.pagopa_api.node.nodeforpsp.VerifyPaymentNoticeRes; -import it.gov.pagopa.pagopa_api.xsd.common_types.v1_0.StOutcome; -import it.gov.pagopa.swclient.mil.paymentnotice.bean.Outcome; -import it.gov.pagopa.swclient.mil.paymentnotice.dao.PspConfiguration; -import it.gov.pagopa.swclient.mil.paymentnotice.dao.PspConfEntity; -import it.gov.pagopa.swclient.mil.paymentnotice.dao.PspConfRepository; -import it.gov.pagopa.swclient.mil.paymentnotice.client.NodeForPspWrapper; +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeConstants; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.XMLGregorianCalendar; +import java.math.BigDecimal; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Stream; + +import static io.restassured.RestAssured.given; @QuarkusTest @TestHTTPEndpoint(VerifyPaymentNoticeResource.class) @TestInstance(TestInstance.Lifecycle.PER_CLASS) class VerifyPaymentNoticeResourceTest { - - final static String SESSION_ID = "a6a666e6-97da-4848-b568-99fedccb642c"; - final static String API_VERSION = "1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay"; - - final static String QR_CODE = "qrCode"; - final static String PA_TAX_CODE = "paTaxCode"; - final static String NOTICE_NUMBER = "noticeNumber"; @InjectMock - NodeForPspWrapper pnWrapper; - + NodeForPspWrapper nodeWrapper; + @InjectMock - PspConfRepository pspConfRepository; + @RestClient + MilRestService milRestService; VerifyPaymentNoticeRes verifyPaymentNoticeResOk; - VerifyPaymentNoticeRes verifyPaymentNoticeResKo; + AcquirerConfiguration acquirerConfiguration; + + Map commonHeaders; - PspConfEntity pspConfEntity; @BeforeAll void createTestObjects() { - // PSP configuration - PspConfiguration pspInfo = new PspConfiguration(); - pspInfo.setPspId("AGID_01"); - pspInfo.setPspBroker("97735020584"); - pspInfo.setPspPassword("pwd_AgID"); + // common headers + commonHeaders = new HashMap<>(); + commonHeaders.put("RequestId", UUID.randomUUID().toString()); + commonHeaders.put("Version", "1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay"); + commonHeaders.put("AcquirerId", "4585625"); + commonHeaders.put("Channel", "ATM"); + commonHeaders.put("TerminalId", "0aB9wXyZ"); + commonHeaders.put("SessionId", UUID.randomUUID().toString()); + + + // acquirer PSP configuration + acquirerConfiguration = new AcquirerConfiguration(); + + PspConfiguration pspConfiguration = new PspConfiguration(); + pspConfiguration.setPsp("AGID_01"); + pspConfiguration.setBroker("97735020584"); + pspConfiguration.setChannel("97735020584_07"); + pspConfiguration.setPassword("PLACEHOLDER"); + + acquirerConfiguration.setPspConfigForVerifyAndActivate(pspConfiguration); + acquirerConfiguration.setPspConfigForGetFeeAndClosePayment(pspConfiguration); - pspConfEntity = new PspConfEntity(); - pspConfEntity.acquirerId = "4585625"; - pspConfEntity.pspConfiguration = pspInfo; // node verify response OK @@ -133,6 +141,10 @@ void createTestObjects() { verifyPaymentNoticeResOk.setOfficeName("officeName"); verifyPaymentNoticeResOk.setCompanyName("companyName"); + } + + private VerifyPaymentNoticeRes generateKoNodeResponse(String faultCode, String originalFaultCode) { + // node verify response KO // @@ -148,32 +160,42 @@ void createTestObjects() { // CtFaultBean ctFaultBean = new CtFaultBean(); - ctFaultBean.setFaultCode("PPT_SINTASSI_EXTRAXSD"); - ctFaultBean.setFaultString("Errore di sintassi extra XSD."); - ctFaultBean.setId("NodoDeiPagamentiSPC"); - ctFaultBean.setDescription("Errore validazione XML [Envelope/Body/verifyPaymentNoticeReq/qrCode/noticeNumber] - cvc-pattern-valid: il valore \"30205\" " + - "non è valido come facet rispetto al pattern \"[0-9]{18}\" per il tipo 'stNoticeNumber'."); + ctFaultBean.setFaultCode(faultCode); + ctFaultBean.setOriginalFaultCode(originalFaultCode); + + VerifyPaymentNoticeRes verifyPaymentNoticeRes = new VerifyPaymentNoticeRes(); + verifyPaymentNoticeRes.setOutcome(StOutcome.KO); + verifyPaymentNoticeRes.setFault(ctFaultBean); - verifyPaymentNoticeResKo = new VerifyPaymentNoticeRes(); - verifyPaymentNoticeResKo.setOutcome(StOutcome.KO); - verifyPaymentNoticeResKo.setFault(ctFaultBean); + return verifyPaymentNoticeRes; + } + private Stream provideNodeIntegrationErrorCases() { + return Stream.of( + Arguments.of(ExceptionType.CLIENT_WEB_APPLICATION_EXCEPTION_400, ErrorCode.ERROR_CALLING_NODE_SOAP_SERVICES), + Arguments.of(ExceptionType.CLIENT_WEB_APPLICATION_EXCEPTION_500, ErrorCode.ERROR_CALLING_NODE_SOAP_SERVICES), + Arguments.of(ExceptionType.TIMEOUT_EXCEPTION, ErrorCode.ERROR_CALLING_NODE_SOAP_SERVICES), + Arguments.of(ExceptionType.UNPARSABLE_EXCEPTION, ErrorCode.ERROR_CALLING_NODE_SOAP_SERVICES) + ); } + private Stream provideMilIntegrationErrorCases() { + return Stream.of( + Arguments.of(ExceptionType.CLIENT_WEB_APPLICATION_EXCEPTION_400, ErrorCode.ERROR_CALLING_MIL_REST_SERVICES), + Arguments.of(ExceptionType.CLIENT_WEB_APPLICATION_EXCEPTION_404, ErrorCode.UNKNOWN_ACQUIRER_ID), + Arguments.of(ExceptionType.CLIENT_WEB_APPLICATION_EXCEPTION_500, ErrorCode.ERROR_CALLING_MIL_REST_SERVICES), + Arguments.of(ExceptionType.TIMEOUT_EXCEPTION, ErrorCode.ERROR_CALLING_MIL_REST_SERVICES), + Arguments.of(ExceptionType.UNPARSABLE_EXCEPTION, ErrorCode.ERROR_CALLING_MIL_REST_SERVICES) + ); + } @Test void testVerifyByQrCode_400() { Response response = given() - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() - .pathParam(QR_CODE, "PAGOPA|100000000000000000|20000000000|9999") + .pathParam("qrCode", "PAGOPA|100000000000000000|20000000000|9999") .when() .get("/{qrCode}") .then() @@ -196,18 +218,12 @@ void testVerifyByQrCode_400() { void testVerifyByTaxCodeAndNoticeNumber_400() { Response response = given() - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() - .pathParam(PA_TAX_CODE, "2000000") - .pathParam(NOTICE_NUMBER, "10000000000") + .pathParam("paTaxCode", "2000000") + .pathParam("noticeNumber", "10000000000") .when() - .get("/{"+ PA_TAX_CODE + "}/{" + NOTICE_NUMBER + "}") + .get("/{paTaxCode}/{noticeNumber}") .then() .extract() .response(); @@ -230,23 +246,17 @@ void testVerifyByTaxCodeAndNoticeNumber_400() { void testVerifyByQrCode_200_nodeOk() { Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.of(pspConfEntity))); + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); Mockito - .when(pnWrapper.verifyPaymentNotice(Mockito.any())) + .when(nodeWrapper.verifyPaymentNotice(Mockito.any())) .thenReturn(Uni.createFrom().item(verifyPaymentNoticeResOk)); Response response = given() - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() - .pathParam(QR_CODE, "PAGOPA|002|302051234567890125|77777777777|9999") + .pathParam("qrCode", "PAGOPA|002|302051234567890125|77777777777|9999") .when() .get("/{qrCode}") .then() @@ -256,35 +266,34 @@ void testVerifyByQrCode_200_nodeOk() { Assertions.assertEquals(200, response.statusCode()); Assertions.assertNull(response.jsonPath().getJsonObject("errors")); Assertions.assertEquals(Outcome.OK.toString(), response.jsonPath().getString("outcome")); - Assertions.assertEquals(verifyPaymentNoticeResOk.getPaymentList().getPaymentOptionDescription().get(0).getAmount().multiply(new BigDecimal(100)).longValue(), response.jsonPath().getLong("amount")); + Assertions.assertEquals( + verifyPaymentNoticeResOk.getPaymentList().getPaymentOptionDescription().get(0).getAmount().multiply(new BigDecimal(100)).longValue(), + response.jsonPath().getLong("amount")); Assertions.assertEquals("2021-07-31", response.jsonPath().getString("dueDate")); - Assertions.assertEquals(verifyPaymentNoticeResOk.getPaymentList().getPaymentOptionDescription().get(0).getPaymentNote(), response.jsonPath().getString("note")); + Assertions.assertEquals( + verifyPaymentNoticeResOk.getPaymentList().getPaymentOptionDescription().get(0).getPaymentNote(), + response.jsonPath().getString("note")); Assertions.assertEquals(verifyPaymentNoticeResOk.getPaymentDescription(), response.jsonPath().getString("description")); Assertions.assertEquals(verifyPaymentNoticeResOk.getCompanyName(), response.jsonPath().getString("company")); Assertions.assertEquals(verifyPaymentNoticeResOk.getOfficeName(), response.jsonPath().getString("office")); } - @Test - void testVerifyByQrCode_200_nodeKo() { + @ParameterizedTest + @CsvFileSource(resources = "/node_error_mapping.csv", numLinesToSkip = 1) + void testVerifyByQrCode_200_nodeKo(String faultCode, String originalFaultCode, String milOutcome) { Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.of(pspConfEntity))); + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); Mockito - .when(pnWrapper.verifyPaymentNotice(Mockito.any())) - .thenReturn(Uni.createFrom().item(verifyPaymentNoticeResKo)); + .when(nodeWrapper.verifyPaymentNotice(Mockito.any())) + .thenReturn(Uni.createFrom().item(generateKoNodeResponse(faultCode, originalFaultCode))); Response response = given() - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() - .pathParam(QR_CODE, "PAGOPA|002|100000000000000000|20000000000|9999") + .pathParam("qrCode", "PAGOPA|002|100000000000000000|20000000000|9999") .when() .get("/{qrCode}") .then() @@ -293,7 +302,7 @@ void testVerifyByQrCode_200_nodeKo() { Assertions.assertEquals(200, response.statusCode()); Assertions.assertNull(response.jsonPath().getJsonObject("errors")); - Assertions.assertEquals("WRONG_NOTICE_DATA", response.jsonPath().getString("outcome")); + Assertions.assertEquals(milOutcome, response.jsonPath().getString("outcome")); Assertions.assertNull(response.jsonPath().getJsonObject("amount")); Assertions.assertNull(response.jsonPath().getJsonObject("dueDate")); Assertions.assertNull(response.jsonPath().getJsonObject("note")); @@ -302,24 +311,53 @@ void testVerifyByQrCode_200_nodeKo() { Assertions.assertNull(response.jsonPath().getJsonObject("office")); } - - @Test - void testVerifyByQrCode_500_pspInfoNotFound() { + + @ParameterizedTest + @MethodSource("provideNodeIntegrationErrorCases") + void testVerifyByQrCode_500_nodeError(ExceptionType exceptionType, String errorCode) { + + Mockito + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.empty())); + .when(nodeWrapper.verifyPaymentNotice(Mockito.any())) + .thenReturn(Uni.createFrom().failure(TestUtils.getException(exceptionType))); + + Response response = given() + .headers(commonHeaders) + .and() + .pathParam("qrCode", "PAGOPA|002|100000000000000000|20000000000|9999") + .when() + .get("/{qrCode}") + .then() + .extract() + .response(); + + Assertions.assertEquals(500, response.statusCode()); + Assertions.assertTrue(response.jsonPath().getList("errors").contains(errorCode)); + Assertions.assertNull(response.jsonPath().getJsonObject("outcome")); + Assertions.assertNull(response.jsonPath().getJsonObject("amount")); + Assertions.assertNull(response.jsonPath().getJsonObject("dueDate")); + Assertions.assertNull(response.jsonPath().getJsonObject("note")); + Assertions.assertNull(response.jsonPath().getJsonObject("description")); + Assertions.assertNull(response.jsonPath().getJsonObject("company")); + Assertions.assertNull(response.jsonPath().getJsonObject("office")); + } + + + @ParameterizedTest + @MethodSource("provideMilIntegrationErrorCases") + void testVerifyByQrCode_500_milError(ExceptionType exceptionType, String errorCode) { + + Mockito + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().failure(TestUtils.getException(exceptionType))); Response response = given() - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() - .pathParam(QR_CODE, "PAGOPA|002|100000000000000000|20000000000|9999") + .pathParam("qrCode", "PAGOPA|002|100000000000000000|20000000000|9999") .when() .get("/{qrCode}") .then() @@ -327,7 +365,7 @@ void testVerifyByQrCode_500_pspInfoNotFound() { .response(); Assertions.assertEquals(500, response.statusCode()); - Assertions.assertTrue(response.jsonPath().getList("errors").contains(ErrorCode.UNKNOWN_ACQUIRER_ID)); + Assertions.assertTrue(response.jsonPath().getList("errors").contains(errorCode)); Assertions.assertNull(response.jsonPath().getJsonObject("outcome")); Assertions.assertNull(response.jsonPath().getJsonObject("amount")); Assertions.assertNull(response.jsonPath().getJsonObject("dueDate")); @@ -338,30 +376,25 @@ void testVerifyByQrCode_500_pspInfoNotFound() { } + @Test void testVerifyByTaxCodeAndNoticeNumber_200_nodeOk() { Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.of(pspConfEntity))); + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); Mockito - .when(pnWrapper.verifyPaymentNotice(Mockito.any())) + .when(nodeWrapper.verifyPaymentNotice(Mockito.any())) .thenReturn(Uni.createFrom().item(verifyPaymentNoticeResOk)); Response response = given() - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() - .pathParam(PA_TAX_CODE, "20000000000") - .pathParam(NOTICE_NUMBER, "100000000000000000") + .pathParam("paTaxCode", "20000000000") + .pathParam("noticeNumber", "100000000000000000") .when() - .get("/{"+ PA_TAX_CODE + "}/{" + NOTICE_NUMBER + "}") + .get("/{paTaxCode}/{noticeNumber}") .then() .extract() .response(); @@ -379,37 +412,32 @@ void testVerifyByTaxCodeAndNoticeNumber_200_nodeOk() { } - @Test - void testVerifyByTaxCodeAndNoticeNumber_200_nodeKo() { + @ParameterizedTest + @CsvFileSource(resources = "/node_error_mapping.csv", numLinesToSkip = 1) + void testVerifyByTaxCodeAndNoticeNumber_200_nodeKo(String faultCode, String originalFaultCode, String milOutcome) { Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.of(pspConfEntity))); + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); Mockito - .when(pnWrapper.verifyPaymentNotice(Mockito.any())) - .thenReturn(Uni.createFrom().item(verifyPaymentNoticeResKo)); + .when(nodeWrapper.verifyPaymentNotice(Mockito.any())) + .thenReturn(Uni.createFrom().item(generateKoNodeResponse(faultCode, originalFaultCode))); Response response = given() - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() - .pathParam(PA_TAX_CODE, "20000000000") - .pathParam(NOTICE_NUMBER, "100000000000000000") + .pathParam("paTaxCode", "20000000000") + .pathParam("noticeNumber", "100000000000000000") .when() - .get("/{"+ PA_TAX_CODE + "}/{" + NOTICE_NUMBER + "}") + .get("/{paTaxCode}/{noticeNumber}") .then() .extract() .response(); Assertions.assertEquals(200, response.statusCode()); Assertions.assertNull(response.jsonPath().getJsonObject("errors")); - Assertions.assertEquals("WRONG_NOTICE_DATA", response.jsonPath().getString("outcome")); + Assertions.assertEquals(milOutcome, response.jsonPath().getString("outcome")); Assertions.assertNull(response.jsonPath().getJsonObject("amount")); Assertions.assertNull(response.jsonPath().getJsonObject("dueDate")); Assertions.assertNull(response.jsonPath().getJsonObject("note")); @@ -419,32 +447,63 @@ void testVerifyByTaxCodeAndNoticeNumber_200_nodeKo() { } - @Test - void testVerifyNoticePaTaxCodeAndNoticeNumber_pspInfoNotFound() { + @ParameterizedTest + @MethodSource("provideNodeIntegrationErrorCases") + void testVerifyByTaxCodeAndNoticeNumber_500_nodeError(ExceptionType exceptionType, String errorCode) { + + Mockito + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().item(acquirerConfiguration)); Mockito - .when(pspConfRepository.findByIdOptional(Mockito.any(String.class))) - .thenReturn(Uni.createFrom().item(Optional.empty())); + .when(nodeWrapper.verifyPaymentNotice(Mockito.any())) + .thenReturn(Uni.createFrom().failure(TestUtils.getException(exceptionType))); + + Response response = given() + .headers(commonHeaders) + .and() + .pathParam("paTaxCode", "20000000000") + .pathParam("noticeNumber", "100000000000000000") + .when() + .get("/{paTaxCode}/{noticeNumber}") + .then() + .extract() + .response(); + + Assertions.assertEquals(500, response.statusCode()); + Assertions.assertTrue(response.jsonPath().getList("errors").contains(errorCode)); + Assertions.assertNull(response.jsonPath().getJsonObject("outcome")); + Assertions.assertNull(response.jsonPath().getJsonObject("amount")); + Assertions.assertNull(response.jsonPath().getJsonObject("dueDate")); + Assertions.assertNull(response.jsonPath().getJsonObject("note")); + Assertions.assertNull(response.jsonPath().getJsonObject("description")); + Assertions.assertNull(response.jsonPath().getJsonObject("company")); + Assertions.assertNull(response.jsonPath().getJsonObject("office")); + + } + + + @ParameterizedTest + @MethodSource("provideMilIntegrationErrorCases") + void testVerifyNoticePaTaxCodeAndNoticeNumber_500_milError(ExceptionType exceptionType, String errorCode) { + + Mockito + .when(milRestService.getPspConfiguration(Mockito.any(String.class), Mockito.any(String.class))) + .thenReturn(Uni.createFrom().failure(TestUtils.getException(exceptionType))); Response response = given() - .headers( - "RequestId", "d0d654e6-97da-4848-b568-99fedccb642b", - "Version", API_VERSION, - "AcquirerId", "4585625", - "Channel", "ATM", - "TerminalId", "0aB9wXyZ", - "SessionId", SESSION_ID) + .headers(commonHeaders) .and() - .pathParam(PA_TAX_CODE, "20000000000") - .pathParam(NOTICE_NUMBER, "100000000000000000") + .pathParam("paTaxCode", "20000000000") + .pathParam("noticeNumber", "100000000000000000") .when() - .get("/{"+ PA_TAX_CODE + "}/{" + NOTICE_NUMBER + "}") + .get("/{paTaxCode}/{noticeNumber}") .then() .extract() .response(); Assertions.assertEquals(500, response.statusCode()); - Assertions.assertTrue(response.jsonPath().getList("errors").contains(ErrorCode.UNKNOWN_ACQUIRER_ID)); + Assertions.assertTrue(response.jsonPath().getList("errors").contains(errorCode)); Assertions.assertNull(response.jsonPath().getJsonObject("outcome")); Assertions.assertNull(response.jsonPath().getJsonObject("amount")); Assertions.assertNull(response.jsonPath().getJsonObject("dueDate")); @@ -454,5 +513,5 @@ void testVerifyNoticePaTaxCodeAndNoticeNumber_pspInfoNotFound() { Assertions.assertNull(response.jsonPath().getJsonObject("office")); } - + } diff --git a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/ActivatePaymentNoticeResourceTestIT.java b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/ActivatePaymentNoticeResourceTestIT.java index 6dbc192..212865c 100644 --- a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/ActivatePaymentNoticeResourceTestIT.java +++ b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/ActivatePaymentNoticeResourceTestIT.java @@ -12,7 +12,7 @@ import it.gov.pagopa.pagopa_api.xsd.common_types.v1_0.CtFaultBean; import it.gov.pagopa.pagopa_api.xsd.common_types.v1_0.StOutcome; import it.gov.pagopa.swclient.mil.paymentnotice.ErrorCode; -import it.gov.pagopa.swclient.mil.paymentnotice.PaymentTestData; +import it.gov.pagopa.swclient.mil.paymentnotice.util.PaymentTestData; import it.gov.pagopa.swclient.mil.paymentnotice.bean.ActivatePaymentNoticeRequest; import it.gov.pagopa.swclient.mil.paymentnotice.bean.Outcome; import it.gov.pagopa.swclient.mil.paymentnotice.bean.Transfer; @@ -97,7 +97,7 @@ void createTestObjects() { CtTransferPSPV2 transfer1 = new CtTransferPSPV2(); transfer1.setIdTransfer(1); - transfer1.setTransferAmount(new BigDecimal(99.98)); + transfer1.setTransferAmount(new BigDecimal("99.98")); transfer1.setFiscalCodePA("77777777777"); transfer1.setIBAN("IT30N0103076271000001823603"); transfer1.setRemittanceInformation("TARI Comune EC_TE"); @@ -105,7 +105,7 @@ void createTestObjects() { CtTransferPSPV2 transfer2 = new CtTransferPSPV2(); transfer2.setIdTransfer(1); - transfer2.setTransferAmount(new BigDecimal(1.01)); + transfer2.setTransferAmount(new BigDecimal("1.01")); transfer2.setFiscalCodePA("77777777777"); transfer2.setIBAN("IT30N0103076271000001823603"); transfer2.setRemittanceInformation("TARI Comune EC_TE"); diff --git a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/ClosePaymentResourceTestIT.java b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/ClosePaymentResourceTestIT.java index 85aa9ff..d51e752 100644 --- a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/ClosePaymentResourceTestIT.java +++ b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/ClosePaymentResourceTestIT.java @@ -6,7 +6,7 @@ import io.quarkus.test.junit.TestProfile; import io.restassured.http.ContentType; import io.restassured.response.Response; -import it.gov.pagopa.swclient.mil.paymentnotice.PaymentTestData; +import it.gov.pagopa.swclient.mil.paymentnotice.util.PaymentTestData; import it.gov.pagopa.swclient.mil.paymentnotice.bean.ClosePaymentRequest; import it.gov.pagopa.swclient.mil.paymentnotice.bean.Outcome; import it.gov.pagopa.swclient.mil.paymentnotice.dao.PspConfEntity; @@ -86,6 +86,7 @@ void testClosePayment_200_node200_OK() { "AcquirerId", PaymentTestData.ACQUIRER_ID_KNOWN, "Channel", "ATM", "TerminalId", "0aB9wXyZ") + .and() .body(getClosePaymentRequest(Outcome.OK, PaymentTestData.PAY_TID_NODE_OK)) .when() @@ -136,8 +137,7 @@ void testClosePayment_200_node200_KO() { @ParameterizedTest @ValueSource(strings = { PaymentTestData.PAY_TID_NODE_400, - PaymentTestData.PAY_TID_NODE_404, - PaymentTestData.PAY_TID_NODE_422}) + PaymentTestData.PAY_TID_NODE_404}) void testClosePayment_200_nodeError_KO(String paymentTransactionId) { Response response = given() @@ -170,6 +170,7 @@ void testClosePayment_200_nodeError_KO(String paymentTransactionId) { @ValueSource(strings = { PaymentTestData.PAY_TID_NODE_408, PaymentTestData.PAY_TID_NODE_500, + PaymentTestData.PAY_TID_NODE_422, PaymentTestData.PAY_TID_NODE_UNPARSABLE}) void testClosePayment_200_nodeError_OK(String paymentTransactionId) { diff --git a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/IntegrationTestProfile.java b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/IntegrationTestProfile.java index 559ef4b..36f349c 100644 --- a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/IntegrationTestProfile.java +++ b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/IntegrationTestProfile.java @@ -1,7 +1,6 @@ package it.gov.pagopa.swclient.mil.paymentnotice.it; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; import io.quarkus.test.junit.QuarkusTestProfile; import it.gov.pagopa.swclient.mil.paymentnotice.it.resource.MongoTestResource; import it.gov.pagopa.swclient.mil.paymentnotice.it.resource.RedisTestResource; @@ -29,6 +28,8 @@ public Map getConfigOverrides() { configOverrides.put("node.soap-client.read-timeout", "3000"); configOverrides.put("node.soap-client.apim-subscription-key", ""); configOverrides.put("node-rest-client-subscription-key", "abc"); + configOverrides.put("mil-rest-client-subscription-key", "abc"); + configOverrides.put("mil-acquirer-conf-version", "1.0.0"); return configOverrides; } @@ -36,7 +37,6 @@ public Map getConfigOverrides() { @Override public List testResources() { return ImmutableList.of( - // new TestResourceEntry(EnvironmentTestResource.class), new TestResourceEntry(WiremockTestResource.class), new TestResourceEntry(RedisTestResource.class), new TestResourceEntry(MongoTestResource.class) diff --git a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/SendPaymentResultTestIT.java b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/SendPaymentResultTestIT.java index 505e55a..6a6d572 100644 --- a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/SendPaymentResultTestIT.java +++ b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/SendPaymentResultTestIT.java @@ -8,10 +8,12 @@ import io.quarkus.test.junit.TestProfile; import io.restassured.http.ContentType; import io.restassured.response.Response; +import io.vertx.core.net.impl.TrustAllTrustManager; import it.gov.pagopa.swclient.mil.paymentnotice.bean.Outcome; import it.gov.pagopa.swclient.mil.paymentnotice.bean.Payment; import it.gov.pagopa.swclient.mil.paymentnotice.bean.ReceivePaymentStatusRequest; import it.gov.pagopa.swclient.mil.paymentnotice.resource.PaymentResource; +import org.apache.commons.lang3.BooleanUtils; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -21,6 +23,10 @@ import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -58,8 +64,24 @@ public void setIntegrationTestContext(DevServicesContext devServicesContext) { @BeforeAll void createTestObjects() { + // initializing redis client String redisExposedPort = devServicesContext.devServicesProperties().get("test.redis.exposed-port"); - jedisPool = new JedisPool("127.0.0.1", Integer.parseInt(redisExposedPort)); + String password = devServicesContext.devServicesProperties().get("test.redis.password"); + boolean tlsEnabled = BooleanUtils.toBoolean(devServicesContext.devServicesProperties().get("test.redis.tls")); + String redisURI = "redis" + (tlsEnabled ? "s" : "") + "://:" + password + "@127.0.0.1:" + redisExposedPort; + if (tlsEnabled) { + try { + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(null, new TrustManager[] { TrustAllTrustManager.INSTANCE }, null); + jedisPool = new JedisPool(redisURI, sslContext.getSocketFactory(), null, (hostname, session) -> true); + } + catch (NoSuchAlgorithmException | KeyManagementException e) { + logger.error("Error while initializing sslContext for jedis", e); + } + } + else { + jedisPool = new JedisPool(redisURI); + } nodeTransactionId = UUID.randomUUID().toString().replaceAll("-", ""); clientTransactionId = UUID.randomUUID().toString().replaceAll("-", ""); @@ -83,7 +105,8 @@ void createTestObjects() { try (Jedis jedis = jedisPool.getResource()) { jedis.set(nodeTransactionId, new ObjectMapper().writeValueAsString(paymentStatus)); jedis.set(clientTransactionId, new ObjectMapper().writeValueAsString(new ReceivePaymentStatusRequest())); - } catch (JsonProcessingException e) { + } + catch (JsonProcessingException e) { logger.error("Error while saving payment transaction in redis", e); } } diff --git a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/VerifyPaymentNoticeResourceTestIT.java b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/VerifyPaymentNoticeResourceTestIT.java index e51d316..f822ee3 100644 --- a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/VerifyPaymentNoticeResourceTestIT.java +++ b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/VerifyPaymentNoticeResourceTestIT.java @@ -77,23 +77,6 @@ void createTestObjects() { pspConfEntity.acquirerId = ACQUIRER_ID; pspConfEntity.pspConfiguration = pspInfo; - // MongoDB init data - -// ConnectionString mongoConnectionString = new ConnectionString("mongodb://127.0.0.1:" + -// devServicesContext.devServicesProperties().get("test.mongo.exposed-port")); -// CodecRegistry pojoCodecRegistry = fromProviders(PojoCodecProvider.builder().automatic(true).build()); -// CodecRegistry codecRegistry = fromRegistries(MongoClientSettings.getDefaultCodecRegistry(), pojoCodecRegistry); -// MongoClientSettings clientSettings = MongoClientSettings.builder() -// .applyConnectionString(mongoConnectionString) -// .codecRegistry(codecRegistry) -// .build(); -// -// try (MongoClient mongoClient = MongoClients.create(clientSettings)) { -// MongoDatabase database = mongoClient.getDatabase("mil"); -// MongoCollection pspConfigurationCollection = database.getCollection("pspconf", PspConfEntity.class); -// pspConfigurationCollection.countDocuments(); -// pspConfigurationCollection.insertOne(pspConfEntity); -// } // node verify response OK diff --git a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/resource/MongoTestResource.java b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/resource/MongoTestResource.java index 93163d5..a4faa58 100644 --- a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/resource/MongoTestResource.java +++ b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/resource/MongoTestResource.java @@ -55,22 +55,19 @@ public Map start() { try { ExecResult result = mongoContainer.execInContainer("mongosh", "<", "/home/mongo/mongoInit.js"); logger.info("Init script result {}", result); - } catch (Exception e) { logger.error("Error while importing data into DB", e); } // Pass the configuration to the application under test - Map map = ImmutableMap.of( + return ImmutableMap.of( "mongo-connection-string-1","mongodb://" + MONGO_NETWORK_ALIAS + ":" + 27017, "mongo-connection-string-2",MONGO_NETWORK_ALIAS + ":" + 27017, "mongo-connect-timeout", "30", "mongo-read-timeout", "30", "mongo-server-selection-timeout", "30" ); - - return map; } // create a "fake" network using the same id as the one that will be used by Quarkus diff --git a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/resource/RedisTestResource.java b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/resource/RedisTestResource.java index 5605231..4988320 100644 --- a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/resource/RedisTestResource.java +++ b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/resource/RedisTestResource.java @@ -3,6 +3,23 @@ import com.google.common.collect.ImmutableMap; import io.quarkus.test.common.DevServicesContext; import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; +import org.bouncycastle.asn1.x500.X500Name; +import org.bouncycastle.asn1.x509.BasicConstraints; +import org.bouncycastle.asn1.x509.Extension; +import org.bouncycastle.cert.X509CertificateHolder; +import org.bouncycastle.cert.X509ExtensionUtils; +import org.bouncycastle.cert.X509v3CertificateBuilder; +import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter; +import org.bouncycastle.cert.jcajce.JcaX509ExtensionUtils; +import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.bouncycastle.openssl.jcajce.JcaPEMWriter; +import org.bouncycastle.operator.ContentSigner; +import org.bouncycastle.operator.OperatorCreationException; +import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder; +import org.bouncycastle.pkcs.PKCS10CertificationRequest; +import org.bouncycastle.pkcs.PKCS10CertificationRequestBuilder; +import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequestBuilder; import org.junit.runner.Description; import org.junit.runners.model.Statement; import org.slf4j.Logger; @@ -13,6 +30,22 @@ import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.utility.DockerImageName; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.math.BigInteger; +import java.nio.file.Paths; +import java.security.Key; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; +import java.security.Security; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.Date; import java.util.Map; @@ -35,7 +68,7 @@ public Map start() { logger.info("Starting Redis container..."); // Start the needed container(s) - redisContainer = new GenericContainer(DockerImageName.parse("redis:latest")) + redisContainer = new GenericContainer(DockerImageName.parse("redis:6")) .withExposedPorts(6379) .withNetwork(getNetwork()) .withNetworkAliases(REDIS_NETWORK_ALIAS) @@ -44,18 +77,42 @@ public Map start() { redisContainer.withLogConsumer(new Slf4jLogConsumer(logger)); + final String password = "wCou42NVkv7H8"; + + // configure tls + final boolean tlsEnabled = generateRedisCerts(); + if (tlsEnabled) { + redisContainer.withFileSystemBind("./target/redis-certs", "/tls"); + redisContainer.setCommand( + "--tls-port 6379", + "--port 0", + "--tls-cert-file /tls/redis.crt", + "--tls-key-file /tls/redis.key", + // "--tls-ca-cert-file /tls/ca.crt", + "--tls-auth-clients no", + "--requirepass " + password); + } + else { + redisContainer.setCommand("--requirepass " + password); + } + + final String redisEndpoint = "redis" + (tlsEnabled ? "s" : "") + "://:" + password + "@" + REDIS_NETWORK_ALIAS + ":" + 6379; + redisContainer.start(); - final String redisEndpoint = "redis://" + REDIS_NETWORK_ALIAS + ":" + 6379; final Integer exposedPort = redisContainer.getMappedPort(6379); devServicesContext.devServicesProperties().put("test.redis.exposed-port", exposedPort.toString()); + devServicesContext.devServicesProperties().put("test.redis.tls", Boolean.toString(tlsEnabled)); + devServicesContext.devServicesProperties().put("test.redis.password", password); // Pass the configuration to the application under test return ImmutableMap.of( - "redis.connection.string", redisEndpoint + "redis.connection.string", redisEndpoint, + "quarkus.redis.tls.trust-all", "true" ); } + // create a "fake" network using the same id as the one that will be used by Quarkus // using the network is the only way to make the withNetworkAliases work private Network getNetwork() { @@ -87,4 +144,112 @@ public void stop() { logger.info("Redis container stopped"); } } + + /** + * Method to generate the certificate to enable ssl on Redis. + * MODIFIED from the redis server gen-certs utils + */ + private static boolean generateRedisCerts() { + + boolean tlsEnabled = false; + + try { + final Provider bouncyCastleProvider = new BouncyCastleProvider(); + Security.addProvider(bouncyCastleProvider); + + // generate CA keypair + final KeyPairGenerator caKeyPairGenerator = KeyPairGenerator.getInstance("RSA", bouncyCastleProvider); + caKeyPairGenerator.initialize(4096); + final KeyPair caKeyPair = caKeyPairGenerator.generateKeyPair(); + + // configure ca certificate + final X500Name caSubject = new X500Name("CN=Certificate Authority,O=Redis Test"); + final Instant now = Instant.now(); + final X509v3CertificateBuilder caCertificateBuilder = new JcaX509v3CertificateBuilder( + caSubject, + BigInteger.valueOf(now.getEpochSecond()), + Date.from(now), + Date.from(now.plus(365*10, ChronoUnit.DAYS)), + caSubject, + caKeyPair.getPublic() + ); + + // flag certificate as CA + caCertificateBuilder.addExtension(Extension.basicConstraints, true, new BasicConstraints(true)); + + // generate ca certificate + final JcaContentSignerBuilder signerBuilder = new JcaContentSignerBuilder("SHA256WithRSA").setProvider(bouncyCastleProvider); + final ContentSigner signer = signerBuilder.build(caKeyPair.getPrivate()); + + final X509CertificateHolder caCertificateHolder = caCertificateBuilder.build(signer); + final JcaX509CertificateConverter converter = new JcaX509CertificateConverter().setProvider(bouncyCastleProvider); + + // save ca certificate to filesystem + final File caCertificateFile = Paths.get("./target/redis-certs/ca.crt").toFile(); + x509CertificateToPem(converter.getCertificate(caCertificateHolder), caCertificateFile); + + // generate server keypair + final KeyPairGenerator serverKeyPairGenerator = KeyPairGenerator.getInstance("RSA", bouncyCastleProvider); + serverKeyPairGenerator.initialize(2048); + final KeyPair serverKeyPair = caKeyPairGenerator.generateKeyPair(); + + // save server key to filesystem + final File serverKeyFile = Paths.get("./target/redis-certs/redis.key").toFile(); + keyToPem(serverKeyPair.getPrivate(), serverKeyFile); + + // generate server csr + final JcaContentSignerBuilder csrBuilder = new JcaContentSignerBuilder("SHA256WithRSA").setProvider(bouncyCastleProvider); + final ContentSigner csrContentSigner = csrBuilder.build(caKeyPair.getPrivate()); + + final X500Name subject = new X500Name("CN=Generic-cert,O=Redis Test"); + final PKCS10CertificationRequestBuilder p10Builder = new JcaPKCS10CertificationRequestBuilder(subject, serverKeyPair.getPublic()); + final PKCS10CertificationRequest csr = p10Builder.build(csrContentSigner); + + // configure server certificate + final X509v3CertificateBuilder serverCertificateBuilder = new X509v3CertificateBuilder( + caSubject, + BigInteger.valueOf(now.getEpochSecond()), + Date.from(now), + Date.from(now.plus(365, ChronoUnit.DAYS)), + csr.getSubject(), + csr.getSubjectPublicKeyInfo()); + + final X509ExtensionUtils issuedCertExtUtils = new JcaX509ExtensionUtils(); + + // flag certificate as not ca + serverCertificateBuilder.addExtension(Extension.basicConstraints, true, new BasicConstraints(false)); + serverCertificateBuilder.addExtension(Extension.authorityKeyIdentifier, false, issuedCertExtUtils.createAuthorityKeyIdentifier(caCertificateHolder)); + serverCertificateBuilder.addExtension(Extension.subjectKeyIdentifier, false, issuedCertExtUtils.createSubjectKeyIdentifier(csr.getSubjectPublicKeyInfo())); + + // generate server certificate + final X509CertificateHolder serverCertificateHolder = serverCertificateBuilder.build(csrContentSigner); + + // save server certificate to filesystem + final File serverCertificateFile = Paths.get("./target/redis-certs/redis.crt").toFile(); + x509CertificateToPem(converter.getCertificate(serverCertificateHolder), serverCertificateFile); + + tlsEnabled = true; + } + catch (NoSuchAlgorithmException | OperatorCreationException | IOException | CertificateException e) { + logger.error("Error while generating redis certificates", e); + } + + return tlsEnabled; + } + + private static void keyToPem(final Key key, final File certificateFile) throws IOException { + final FileWriter writer = new FileWriter(certificateFile); + final JcaPEMWriter pemWriter = new JcaPEMWriter(writer); + pemWriter.writeObject(key); + pemWriter.flush(); + pemWriter.close(); + } + private static void x509CertificateToPem(final X509Certificate cert, final File certificateFile) throws IOException { + final FileWriter writer = new FileWriter(certificateFile); + final JcaPEMWriter pemWriter = new JcaPEMWriter(writer); + pemWriter.writeObject(cert); + pemWriter.flush(); + pemWriter.close(); + } + } diff --git a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/resource/WiremockTestResource.java b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/resource/WiremockTestResource.java index db2a0f8..bcfe528 100644 --- a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/resource/WiremockTestResource.java +++ b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/it/resource/WiremockTestResource.java @@ -51,7 +51,8 @@ public Map start() { // Pass the configuration to the application under test return ImmutableMap.of( "node.rest-service.url", wiremockEndpoint, - "node.soap-service.url", wiremockEndpoint + "/nodo/node-for-psp/v1" + "node.soap-service.url", wiremockEndpoint + "/nodo/node-for-psp/v1", + "mil.rest-service.url", wiremockEndpoint ); } diff --git a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/util/ExceptionType.java b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/util/ExceptionType.java new file mode 100644 index 0000000..ee8702c --- /dev/null +++ b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/util/ExceptionType.java @@ -0,0 +1,10 @@ +package it.gov.pagopa.swclient.mil.paymentnotice.util; + +public enum ExceptionType { + CLIENT_WEB_APPLICATION_EXCEPTION_400, + CLIENT_WEB_APPLICATION_EXCEPTION_404, + CLIENT_WEB_APPLICATION_EXCEPTION_500, + TIMEOUT_EXCEPTION, + UNPARSABLE_EXCEPTION + +} diff --git a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/PaymentTestData.java b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/util/PaymentTestData.java similarity index 83% rename from src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/PaymentTestData.java rename to src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/util/PaymentTestData.java index f20aad4..03a4ecd 100644 --- a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/PaymentTestData.java +++ b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/util/PaymentTestData.java @@ -1,7 +1,4 @@ -package it.gov.pagopa.swclient.mil.paymentnotice; - -import static org.bson.codecs.configuration.CodecRegistries.fromProviders; -import static org.bson.codecs.configuration.CodecRegistries.fromRegistries; +package it.gov.pagopa.swclient.mil.paymentnotice.util; public final class PaymentTestData { diff --git a/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/util/TestUtils.java b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/util/TestUtils.java new file mode 100644 index 0000000..353427a --- /dev/null +++ b/src/test/java/it/gov/pagopa/swclient/mil/paymentnotice/util/TestUtils.java @@ -0,0 +1,21 @@ +package it.gov.pagopa.swclient.mil.paymentnotice.util; + +import org.jboss.resteasy.reactive.ClientWebApplicationException; + +import java.util.concurrent.TimeoutException; + +public class TestUtils { + + private TestUtils() {} + + public static Throwable getException(ExceptionType exceptionType) { + return switch (exceptionType) { + case TIMEOUT_EXCEPTION -> new TimeoutException(); + case CLIENT_WEB_APPLICATION_EXCEPTION_400 -> new ClientWebApplicationException(400); + case CLIENT_WEB_APPLICATION_EXCEPTION_404 -> new ClientWebApplicationException(404); + case CLIENT_WEB_APPLICATION_EXCEPTION_500 -> new ClientWebApplicationException(500); + case UNPARSABLE_EXCEPTION -> new ClientWebApplicationException(); // TODO generate correct exception + }; + } + +} diff --git a/src/test/postman/Azure_DEV.postman_environment.json b/src/test/postman/Azure_DEV.postman_environment.json new file mode 100644 index 0000000..6f2e1f5 --- /dev/null +++ b/src/test/postman/Azure_DEV.postman_environment.json @@ -0,0 +1,27 @@ +{ + "id": "b9d8291c-9a63-4684-904e-50b71032ddee", + "name": "Azure - DEV", + "values": [ + { + "key": "MIL_PAYMENT_NOTICE_BASE_URL", + "value": "https://mil-d-apim.azure-api.net/mil-payment-notice", + "type": "default", + "enabled": true + }, + { + "key": "acquirer_id", + "value": "4585625", + "type": "default", + "enabled": true + }, + { + "key": "APIM_SUBSCRIPTION_KEY", + "value": "abcde", + "type": "secret", + "enabled": true + } + ], + "_postman_variable_scope": "environment", + "_postman_exported_at": "2023-02-28T16:48:01.881Z", + "_postman_exported_using": "Postman/10.11.1" +} \ No newline at end of file diff --git a/src/test/postman/Payment_Notice_Service.postman_collection.json b/src/test/postman/Payment_Notice_Service.postman_collection.json new file mode 100644 index 0000000..59c1b62 --- /dev/null +++ b/src/test/postman/Payment_Notice_Service.postman_collection.json @@ -0,0 +1,10460 @@ +{ + "info": { + "_postman_id": "3d3485bc-9a0b-4cec-b229-bb560cd9bac3", + "name": "5. Payment Notice Service", + "description": "Test di integrazione per il microservizio mil-payment-notice", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "2465946" + }, + "item": [ + { + "name": "1. Validazione dati", + "item": [ + { + "name": "1. verifyByQrCode", + "item": [ + { + "name": "Validazione header", + "item": [ + { + "name": "verifyByQrCode - RequestId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000001\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByQrCode - RequestId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000002\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "131///00=", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByQrCode - Version non valida", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000004\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "pppL", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByQrCode - Version size non valida", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000003\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay78237829748274", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByQrCode - AcquirerId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000005\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByQrCode - AcquirerId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000006\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "ssk23", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByQrCode - Channel nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000007\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByQrCode - Channel non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000008\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "AATTMM", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByQrCode - MerchantId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00000000B\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByQrCode - MerchantId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00000000C\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "23-32-42-r", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByQrCode - TerminalId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000009\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByQrCode - TerminalId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00000000A\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "13---..99", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});" + ] + } + } + ] + }, + { + "name": "verifyByQrCode - QR code non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000001\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "abcde" + } + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "2. activateByQrCode", + "item": [ + { + "name": "Validazione header", + "item": [ + { + "name": "activateByQrCode - RequestId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000001\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByQrCode - RequestId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000002\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "131///00=", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByQrCode - Version non valida", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000004\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "pppL", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByQrCode - Version size non valida", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000003\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay78237829748274", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByQrCode - AcquirerId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000005\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByQrCode - AcquirerId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000006\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "ssk23", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByQrCode - Channel nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000007\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByQrCode - Channel non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000008\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "AATTMM", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByQrCode - MerchantId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00000000B\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByQrCode - MerchantId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00000000C\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "23-32-42-r", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByQrCode - TerminalId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000009\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByQrCode - TerminalId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00000000A\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "13---..99", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "activateByQrCode - QR code non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000001\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "abcde" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByQrCode - Idempotency Key nulla", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000004\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "{{qr_code}}" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByQrCode - Idempotency Key non valida", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000005\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"abcd\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "{{qr_code}}" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByQrCode - Amount nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000006\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "{{qr_code}}" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByQrCode - Amount minore di 1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000007\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 0\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "{{qr_code}}" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByQrCode - Amount maggiore di 99999999999", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000008\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": \"100000000000\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "{{qr_code}}" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "3. verifyByTaxCodeAndNoticeNumber", + "item": [ + { + "name": "Validazione header", + "item": [ + { + "name": "verifyByTaxCodeAndNoticeNumber - RequestId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000001\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByTaxCodeAndNoticeNumber - RequestId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000002\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "131///00=", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByTaxCodeAndNoticeNumber - Version non valida", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000004\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "pppL", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByTaxCodeAndNoticeNumber - Version size non valida", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000003\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay78237829748274", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByTaxCodeAndNoticeNumber - AcquirerId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000005\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByTaxCodeAndNoticeNumber - AcquirerId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000006\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "ssk23", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByTaxCodeAndNoticeNumber - Channel nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000007\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByTaxCodeAndNoticeNumber - MerchantId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00000000B\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByTaxCodeAndNoticeNumber - Channel non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000008\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "AATTMM", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByTaxCodeAndNoticeNumber - TerminalId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000009\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByTaxCodeAndNoticeNumber - TerminalId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00000000A\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "13---..99", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "verifyByTaxCodeAndNoticeNumber - PA Tax Code non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000002\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:paTaxCode/:noticeNumber", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":paTaxCode", + ":noticeNumber" + ], + "variable": [ + { + "key": "paTaxCode", + "value": "abcde" + }, + { + "key": "noticeNumber", + "value": "{{notice_number}}" + } + ] + } + }, + "response": [] + }, + { + "name": "verifyByTaxCodeAndNoticeNumber - Notice Number non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000003\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:paTaxCode/:noticeNumber", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":paTaxCode", + ":noticeNumber" + ], + "variable": [ + { + "key": "paTaxCode", + "value": "{{pa_tax_code}}" + }, + { + "key": "noticeNumber", + "value": "abcde" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "4. activateByTaxCodeAndNoticeNumber", + "item": [ + { + "name": "Validazione header", + "item": [ + { + "name": "activateByTaxCodeAndNoticeNumber - RequestId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000001\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - RequestId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000002\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "131///00=", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - Version non valida", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000004\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "pppL", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - Version size non valida", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000003\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay78237829748274", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - AcquirerId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000005\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - AcquirerId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000006\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "ssk23", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - Channel nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000007\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - Channel non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000008\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "AATTMM", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - MerchantId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00000000B\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - MerchantId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00000000C\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "23-32-42-r", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - TerminalId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000009\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - TerminalId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00000000A\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "13---..99", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:pa_tax_code/:notice_number", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":pa_tax_code", + ":notice_number" + ], + "variable": [ + { + "key": "pa_tax_code", + "value": "" + }, + { + "key": "notice_number", + "value": "" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - PA Tax Code non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000002\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:paTaxCode/:noticeNumber", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":paTaxCode", + ":noticeNumber" + ], + "variable": [ + { + "key": "paTaxCode", + "value": "abcde" + }, + { + "key": "noticeNumber", + "value": "{{notice_number}}" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - Notice Number non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000003\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:paTaxCode/:noticeNumber", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":paTaxCode", + ":noticeNumber" + ], + "variable": [ + { + "key": "paTaxCode", + "value": "{{pa_tax_code}}" + }, + { + "key": "noticeNumber", + "value": "abcde" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - Idempotency Key nulla", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000004\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:paTaxCode/:noticeNumber", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":paTaxCode", + ":noticeNumber" + ], + "variable": [ + { + "key": "paTaxCode", + "value": "{{pa_tax_code}}" + }, + { + "key": "noticeNumber", + "value": "{{notice_number}}" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - Idempotency Key non valida", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000005\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"abcd\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:paTaxCode/:noticeNumber", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":paTaxCode", + ":noticeNumber" + ], + "variable": [ + { + "key": "paTaxCode", + "value": "{{pa_tax_code}}" + }, + { + "key": "noticeNumber", + "value": "{{notice_number}}" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - Amount nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000006\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:paTaxCode/:noticeNumber", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":paTaxCode", + ":noticeNumber" + ], + "variable": [ + { + "key": "paTaxCode", + "value": "{{pa_tax_code}}" + }, + { + "key": "noticeNumber", + "value": "{{notice_number}}" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - Amount minore di 1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000007\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 0\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:paTaxCode/:noticeNumber", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":paTaxCode", + ":noticeNumber" + ], + "variable": [ + { + "key": "paTaxCode", + "value": "{{pa_tax_code}}" + }, + { + "key": "noticeNumber", + "value": "{{notice_number}}" + } + ] + } + }, + "response": [] + }, + { + "name": "activateByTaxCodeAndNoticeNumber - Amount maggiore di 99999999999", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000008\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": \"100000000000\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:paTaxCode/:noticeNumber", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":paTaxCode", + ":noticeNumber" + ], + "variable": [ + { + "key": "paTaxCode", + "value": "{{pa_tax_code}}" + }, + { + "key": "noticeNumber", + "value": "{{notice_number}}" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "5. close", + "item": [ + { + "name": "Validazione header", + "item": [ + { + "name": "close - RequestId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000001\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - RequestId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000002\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "131///00=", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Version non valida", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000004\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "pppL", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Version size non valida", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000003\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay78237829748274", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - AcquirerId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000005\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - AcquirerId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000006\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "ssk23", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Channel nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000007\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Channel non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000008\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "AATTMM", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - MerchantId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00000000B\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - MerchantId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00000000C\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "23-32-42-r", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - TerminalId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000009\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - TerminalId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00000000A\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "13---..99", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"{{idempotency_key}}\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "close - Outcome nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000009\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"paymentTokens\": [\r\n \"648fhg36s95jfg7DS\"\r\n ],\r\n \"paymentMethod\": \"PAGOBANCOMAT\",\r\n \"transactionId\": \"27de01c5c4b24a48802a59696c2bef20\",\r\n \"totalAmount\": 234234,\r\n \"fee\": 897,\r\n \"timestampOp\": \"2022-11-12T08:53:55\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Outcome non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00800000A\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"test\",\r\n \"paymentTokens\": [\r\n \"648fhg36s95jfg7DS\"\r\n ],\r\n \"paymentMethod\": \"PAGOBANCOMAT\",\r\n \"transactionId\": \"27de01c5c4b24a48802a59696c2bef20\",\r\n \"totalAmount\": 234234,\r\n \"fee\": 897,\r\n \"timestampOp\": \"2022-11-12T08:53:55\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Payment Tokens nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00800000B\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentMethod\": \"PAGOBANCOMAT\",\r\n \"transactionId\": \"27de01c5c4b24a48802a59696c2bef20\",\r\n \"totalAmount\": 234234,\r\n \"fee\": 897,\r\n \"timestampOp\": \"2022-11-12T08:53:55\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Payment Tokens con più di 5 elementi", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00800000C\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentTokens\": [\r\n \"648fhg36s95jfg7DS\",\r\n \"648fhg36s95jfg7DS\",\r\n \"648fhg36s95jfg7DS\",\r\n \"648fhg36s95jfg7DS\",\r\n \"648fhg36s95jfg7DS\",\r\n \"648fhg36s95jfg7DS\"\r\n ],\r\n \"paymentMethod\": \"PAGOBANCOMAT\",\r\n \"transactionId\": \"27de01c5c4b24a48802a59696c2bef20\",\r\n \"totalAmount\": 234234,\r\n \"fee\": 897,\r\n \"timestampOp\": \"2022-11-12T08:53:55\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Payment Token non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00800000D\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentTokens\": [\r\n \"sEoITKKOCAJG9wzOmXrHErjzppiLPTcrbopkgJ3X\"\r\n ],\r\n \"paymentMethod\": \"PAGOBANCOMAT\",\r\n \"transactionId\": \"27de01c5c4b24a48802a59696c2bef20\",\r\n \"totalAmount\": 234234,\r\n \"fee\": 897,\r\n \"timestampOp\": \"2022-11-12T08:53:55\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Payment Method nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00800000E\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentTokens\": [\r\n \"648fhg36s95jfg7DS\"\r\n ],\r\n \"transactionId\": \"27de01c5c4b24a48802a59696c2bef20\",\r\n \"totalAmount\": 234234,\r\n \"fee\": 897,\r\n \"timestampOp\": \"2022-11-12T08:53:55\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Payment Method non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00800000F\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentTokens\": [\r\n \"648fhg36s95jfg7DS\"\r\n ],\r\n \"paymentMethod\": \"test\",\r\n \"transactionId\": \"27de01c5c4b24a48802a59696c2bef20\",\r\n \"totalAmount\": 234234,\r\n \"fee\": 897,\r\n \"timestampOp\": \"2022-11-12T08:53:55\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Transaction ID nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000010\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentTokens\": [\r\n \"648fhg36s95jfg7DS\"\r\n ],\r\n \"paymentMethod\": \"PAGOBANCOMAT\",\r\n \"totalAmount\": 234234,\r\n \"fee\": 897,\r\n \"timestampOp\": \"2022-11-12T08:53:55\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Transaction ID non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000011\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentTokens\": [\r\n \"648fhg36s95jfg7DS\"\r\n ],\r\n \"paymentMethod\": \"PAGOBANCOMAT\",\r\n \"transactionId\": \"27de01c5c4b24a488-02a59696c2bef20\",\r\n \"totalAmount\": 234234,\r\n \"fee\": 897,\r\n \"timestampOp\": \"2022-11-12T08:53:55\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Total Amount nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000012\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentTokens\": [\r\n \"648fhg36s95jfg7DS\"\r\n ],\r\n \"paymentMethod\": \"PAGOBANCOMAT\",\r\n \"transactionId\": \"27de01c5c4b24a48802a59696c2bef20\",\r\n \"fee\": 897,\r\n \"timestampOp\": \"2022-11-12T08:53:55\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Total Amount minore di 1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000013\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentTokens\": [\r\n \"648fhg36s95jfg7DS\"\r\n ],\r\n \"paymentMethod\": \"PAGOBANCOMAT\",\r\n \"transactionId\": \"27de01c5c4b24a48802a59696c2bef20\",\r\n \"totalAmount\": 0,\r\n \"fee\": 897,\r\n \"timestampOp\": \"2022-11-12T08:53:55\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Total Amount maggiore di 99999999999", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000014\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentTokens\": [\r\n \"648fhg36s95jfg7DS\"\r\n ],\r\n \"paymentMethod\": \"PAGOBANCOMAT\",\r\n \"transactionId\": \"27de01c5c4b24a48802a59696c2bef20\",\r\n \"totalAmount\": 100000000000,\r\n \"fee\": 897,\r\n \"timestampOp\": \"2022-11-12T08:53:55\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Fee nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000015\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentTokens\": [\r\n \"648fhg36s95jfg7DS\"\r\n ],\r\n \"paymentMethod\": \"PAGOBANCOMAT\",\r\n \"transactionId\": \"27de01c5c4b24a48802a59696c2bef20\",\r\n \"totalAmount\": 234234,\r\n \"timestampOp\": \"2022-11-12T08:53:55\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Fee minore di 1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000016\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentTokens\": [\r\n \"648fhg36s95jfg7DS\"\r\n ],\r\n \"paymentMethod\": \"PAGOBANCOMAT\",\r\n \"transactionId\": \"27de01c5c4b24a48802a59696c2bef20\",\r\n \"totalAmount\": 234234,\r\n \"fee\": 0,\r\n \"timestampOp\": \"2022-11-12T08:53:55\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Fee maggiore di 99999999999", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000017\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentTokens\": [\r\n \"648fhg36s95jfg7DS\"\r\n ],\r\n \"paymentMethod\": \"PAGOBANCOMAT\",\r\n \"transactionId\": \"27de01c5c4b24a48802a59696c2bef20\",\r\n \"totalAmount\": 234234,\r\n \"fee\": 100000000000,\r\n \"timestampOp\": \"2022-11-12T08:53:55\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Timestamp Op nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000018\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentTokens\": [\r\n \"648fhg36s95jfg7DS\"\r\n ],\r\n \"paymentMethod\": \"PAGOBANCOMAT\",\r\n \"transactionId\": \"27de01c5c4b24a48802a59696c2bef20\",\r\n \"totalAmount\": 234234,\r\n \"fee\": 897\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "close - Timestamp Op non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000019\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentTokens\": [\r\n \"648fhg36s95jfg7DS\"\r\n ],\r\n \"paymentMethod\": \"PAGOBANCOMAT\",\r\n \"transactionId\": \"27de01c5c4b24a48802a59696c2bef20\",\r\n \"totalAmount\": 234234,\r\n \"fee\": 897,\r\n \"timestampOp\": \"test\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "6. receivePaymentStatus", + "item": [ + { + "name": "receivePaymentStatus - Transaction ID non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000011\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentDate\": \"2022-11-12T08:53:55\",\r\n \"payments\": [\r\n {\r\n \"paymentToken\": \"648fhg36s95jfg7DS\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"15376371009\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "27de01c5c4b24a488-02a59696c2bef20" + } + ] + } + }, + "response": [] + }, + { + "name": "receivePaymentStatus - Outcome nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000009\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"paymentDate\": \"2022-11-12T08:53:55\",\r\n \"payments\": [\r\n {\r\n \"paymentToken\": \"648fhg36s95jfg7DS\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"15376371009\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "27de01c5c4b24a48802a59696c2bef20" + } + ] + } + }, + "response": [] + }, + { + "name": "receivePaymentStatus - Outcome non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00800000A\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"test\",\r\n \"paymentDate\": \"2022-11-12T08:53:55\",\r\n \"payments\": [\r\n {\r\n \"paymentToken\": \"648fhg36s95jfg7DS\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"15376371009\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "27de01c5c4b24a48802a59696c2bef20" + } + ] + } + }, + "response": [] + }, + { + "name": "receivePaymentStatus - Payment Date nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00800001A\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"payments\": [\r\n {\r\n \"paymentToken\": \"648fhg36s95jfg7DS\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"15376371009\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "27de01c5c4b24a48802a59696c2bef20" + } + ] + } + }, + "response": [] + }, + { + "name": "receivePaymentStatus - Payment Date non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00800001B\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentDate\": \"test\",\r\n \"payments\": [\r\n {\r\n \"paymentToken\": \"648fhg36s95jfg7DS\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"15376371009\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "27de01c5c4b24a48802a59696c2bef20" + } + ] + } + }, + "response": [] + }, + { + "name": "receivePaymentStatus - Payments nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00800001C\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentDate\": \"2022-11-12T08:53:55\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "27de01c5c4b24a48802a59696c2bef20" + } + ] + } + }, + "response": [] + }, + { + "name": "receivePaymentStatus - Payments con più di 5 elementi", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00800001D\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentDate\": \"2022-11-12T08:53:55\",\r\n \"payments\": [\r\n {\r\n \"paymentToken\": \"648fhg36s95jfg7DS\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"15376371009\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n },\r\n {\r\n \"paymentToken\": \"648fhg36s95jfg7DS\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"15376371009\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n },\r\n {\r\n \"paymentToken\": \"648fhg36s95jfg7DS\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"15376371009\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n },\r\n {\r\n \"paymentToken\": \"648fhg36s95jfg7DS\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"15376371009\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n },\r\n {\r\n \"paymentToken\": \"648fhg36s95jfg7DS\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"15376371009\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n },\r\n {\r\n \"paymentToken\": \"648fhg36s95jfg7DS\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"15376371009\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "27de01c5c4b24a48802a59696c2bef20" + } + ] + } + }, + "response": [] + }, + { + "name": "receivePaymentStatus - Payment Token non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00800000D\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentDate\": \"2022-11-12T08:53:55\",\r\n \"payments\": [\r\n {\r\n \"paymentToken\": \"sEoITKKOCAJG9wzOmXrHErjzppiLPTcrbopkgJ3X\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"15376371009\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "27de01c5c4b24a48802a59696c2bef20" + } + ] + } + }, + "response": [] + }, + { + "name": "receivePaymentStatus - Description non valida", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00800001E\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentDate\": \"2022-11-12T08:53:55\",\r\n \"payments\": [\r\n {\r\n \"paymentToken\": \"648fhg36s95jfg7DS\",\r\n \"description\": \"Ab aliquid odio iste quo voluptas voluptatem dignissimos velit. Recusandae facilis qui commodi ea magnam enim nostrum quia quis. Nihil est suscipit assumenda ut voluptatem sed. Esse ab voluptas odit qui molestiae. Rem est nesciunt est quis ipsam expedita consequuntur.\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"15376371009\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "27de01c5c4b24a48802a59696c2bef20" + } + ] + } + }, + "response": [] + }, + { + "name": "receivePaymentStatus - Creditor Reference ID non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00800001F\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentDate\": \"2022-11-12T08:53:55\",\r\n \"payments\": [\r\n {\r\n \"paymentToken\": \"648fhg36s95jfg7DS\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"sEoITKKOCAJG9wzOmXrHErjzppiLPTcrbopkgJ3X\",\r\n \"fiscalCode\": \"15376371009\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "27de01c5c4b24a48802a59696c2bef20" + } + ] + } + }, + "response": [] + }, + { + "name": "receivePaymentStatus - Fiscal code non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000020\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentDate\": \"2022-11-12T08:53:55\",\r\n \"payments\": [\r\n {\r\n \"paymentToken\": \"648fhg36s95jfg7DS\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"test\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "27de01c5c4b24a48802a59696c2bef20" + } + ] + } + }, + "response": [] + }, + { + "name": "receivePaymentStatus - Company non valida", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000021\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentDate\": \"2022-11-12T08:53:55\",\r\n \"payments\": [\r\n {\r\n \"paymentToken\": \"648fhg36s95jfg7DS\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"15376371009\",\r\n \"company\": \"Ab aliquid odio iste quo voluptas voluptatem dignissimos velit. Recusandae facilis qui commodi ea magnam enim nostrum quia quis. Nihil est suscipit assumenda ut voluptatem sed. Esse ab voluptas odit qui molestiae. Rem est nesciunt est quis ipsam expedita consequuntur.\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "27de01c5c4b24a48802a59696c2bef20" + } + ] + } + }, + "response": [] + }, + { + "name": "receivePaymentStatus - Office non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000022\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentDate\": \"2022-11-12T08:53:55\",\r\n \"payments\": [\r\n {\r\n \"paymentToken\": \"648fhg36s95jfg7DS\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"15376371009\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ab aliquid odio iste quo voluptas voluptatem dignissimos velit. Recusandae facilis qui commodi ea magnam enim nostrum quia quis. Nihil est suscipit assumenda ut voluptatem sed. Esse ab voluptas odit qui molestiae. Rem est nesciunt est quis ipsam expedita consequuntur.\",\r\n \"debtor\": \"Mario Rossi\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "27de01c5c4b24a48802a59696c2bef20" + } + ] + } + }, + "response": [] + }, + { + "name": "receivePaymentStatus - Debtor non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000023\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentDate\": \"2022-11-12T08:53:55\",\r\n \"payments\": [\r\n {\r\n \"paymentToken\": \"648fhg36s95jfg7DS\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"15376371009\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Temporibus vitae nisi quo consequatur autem molestias blanditiis. Consequatur quibusdam ut voluptas eos quaerat qui omnis. Excepturi beatae nihil eos pariatur qui. Aut recusandae voluptas labore veritatis sed ducimus voluptatem ratione. Qui numquam quidem quia voluptatem fugiat sint ab voluptas et. Esse velit aperiam vel. Similique asperiores sit ex iusto omnis reprehenderit et ullam. Delectus sed eum debitis. Sit est eum et delectus saepe. Sint atque voluptas ducimus. Est voluptates in saepe aut temporibus sit cumque quis. Non atque placeat asperiores rerum non. Pariatur nobis accusamus tenetur animi. Totam consequuntur iste odit nesciunt et. Sit veniam nihil eos aut aut est. Unde sit necessitatibus eos ut omnis odio. Voluptatem necessitatibus iusto assumenda quaerat sed tempora. Nam dolorem alias explicabo hic sit est asperiores eos dolores. Et minima harum enim tempore adipisci laborum quia. Aliquam et harum nesciunt quod velit. Nam ad adipisci reprehenderit aperiam voluptatem illo consequatur. Et illo quo necessitatibus quam architecto adipisci voluptas. Culpa magni autem officia aut. Reprehenderit quo inventore. Non alias repellendus et. Vel quisquam quis et maiores ea hic esse. Officia et et voluptates nihil voluptates et iste similique. Delectus iusto qui placeat enim rerum.\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "27de01c5c4b24a48802a59696c2bef20" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "7. getPaymentStatus", + "item": [ + { + "name": "Validazione header", + "item": [ + { + "name": "getPaymentStatus - RequestId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000001\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "getPaymentStatus - RequestId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000002\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "131///00=", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "getPaymentStatus - Version non valida", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000004\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "pppL", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "getPaymentStatus - Version size non valida", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000003\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay78237829748274", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "getPaymentStatus - AcquirerId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000005\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "getPaymentStatus - AcquirerId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000006\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "ssk23", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "getPaymentStatus - Channel nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000007\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "getPaymentStatus - Channel non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000008\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "AATTMM", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "getPaymentStatus - MerchantId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00000000B\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "getPaymentStatus - MerchantId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00000000C\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "23-32-42-r", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "getPaymentStatus - TerminalId nullo", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"000000009\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "getPaymentStatus - TerminalId non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"00000000A\");\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "13---..99", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "getPaymentStatus - Transaction ID non valido", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"errors containes value\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.contain(\"008000011\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "27de01c5c4b24a48-802a59696c2bef20" + } + ] + } + }, + "response": [] + } + ] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "const schema = {", + " \"properties\": {", + " \"errors\": {", + " \"type\": \"array\"", + " }", + " }", + "};", + "", + "pm.test('Schema is valid', function() {", + " pm.response.to.have.jsonSchema(schema);", + "});" + ] + } + } + ] + }, + { + "name": "2. Pagamento Spontaneo ATM", + "item": [] + }, + { + "name": "3. Pagamento Spontaneo POS", + "item": [ + { + "name": "1. Scan QR code", + "item": [ + { + "name": "1. Verifica Avviso", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Outcome is OK\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.outcome).to.eql(\"OK\");\r", + "});\r", + "\r", + "pm.test(\"amount is 10099\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.amount).to.eql(10099);\r", + "});\r", + "\r", + "pm.test(\"dueDate is 2021-07-31\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.dueDate).to.eql(\"2021-07-31\");\r", + "});\r", + "\r", + "pm.test(\"note is pagamentoTest\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.note).to.eql(\"pagamentoTest\");\r", + "});\r", + "\r", + "pm.test(\"description is Pagamento di Test\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.description).to.eql(\"Pagamento di Test\");\r", + "});\r", + "\r", + "pm.test(\"company is companyName\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.company).to.eql(\"companyName\");\r", + "});\r", + "\r", + "pm.test(\"office is officeName\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.office).to.eql(\"officeName\");\r", + "});\r", + "\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "{{qr_code}}" + } + ] + } + }, + "response": [] + }, + { + "name": "2. Attivazione Avviso", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Outcome is OK\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.outcome).to.eql(\"OK\");\r", + "});\r", + "\r", + "pm.test(\"amount is 10099\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.amount).to.eql(10099);\r", + "});\r", + "\r", + "pm.test(\"paTaxCode is 77777777777\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.paTaxCode).to.eql(\"77777777777\");\r", + "});\r", + "\r", + "pm.test(\"paymentToken is 3a254e00347d4f29a3607a35d780faac\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.paymentToken).to.eql(\"3a254e00347d4f29a3607a35d780faac\");\r", + "});\r", + "\r", + "pm.test(\"transfers is present\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.transfers).to.have;\r", + "});\r", + "\r", + "var paymentToken = _.get(pm.response.json(), \"paymentToken\");\r", + "console.log(\"paymentToken -> \" + paymentToken);\r", + "if (paymentToken) {\r", + " pm.collectionVariables.set(\"paymentToken\", paymentToken);\r", + "}\r", + "\r", + "var totalAmount = _.get(pm.response.json(), \"amount\");\r", + "console.log(\"totalAmount -> \" + totalAmount);\r", + "if (paymentToken) {\r", + " pm.collectionVariables.set(\"totalAmount\", totalAmount);\r", + "}\r", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment')\r", + "var uuid = require('uuid')\r", + "\r", + "var transactionId = uuid.v4().replace(/-/g, '');\r", + "console.log(\"transactionId ->\" + transactionId);\r", + "pm.collectionVariables.set(\"transactionId\", transactionId);\r", + "\r", + "var timestampOp = moment().utc().format('YYYY-MM-DDTHH:mm:ss');\r", + "console.log(\"timestampOp ->\" + timestampOp);\r", + "pm.collectionVariables.set(\"timestampOp\", timestampOp);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"77777777777_abcDEF1238\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:qrCode", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":qrCode" + ], + "variable": [ + { + "key": "qrCode", + "value": "{{qr_code}}" + } + ] + } + }, + "response": [] + }, + { + "name": "3. Conferma pagamento (OK)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Outcome is OK\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.outcome).to.eql(\"OK\");\r", + "});\r", + "\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentTokens\": [\r\n \"{{paymentToken}}\"\r\n ],\r\n \"paymentMethod\": \"PAGOBANCOMAT\",\r\n \"transactionId\": \"{{transactionId}}\",\r\n \"totalAmount\": {{totalAmount}},\r\n \"fee\": {{fee}},\r\n \"timestampOp\": \"{{timestampOp}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "4. Recupera stato pagamento (KO)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 404\", function () {\r", + " pm.response.to.have.status(404);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "bcb0e6ab48aa426c8e92625424a1321d" + } + ] + } + }, + "response": [] + }, + { + "name": "5. Aggiorna stato pagamento", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentDate\": \"{{timestampOp}}\",\r\n \"payments\": [\r\n {\r\n \"paymentToken\": \"{{paymentToken}}\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"{{pa_tax_code}}\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "{{transactionId}}" + } + ] + } + }, + "response": [] + }, + { + "name": "6. Recupera stato pagamento (OK)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "{{transactionId}}" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "2. Inserimento dati manuale", + "item": [ + { + "name": "1. Verifica Avviso", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Outcome is OK\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.outcome).to.eql(\"OK\");\r", + "});\r", + "\r", + "pm.test(\"amount is 10099\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.amount).to.eql(10099);\r", + "});\r", + "\r", + "pm.test(\"dueDate is 2021-07-31\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.dueDate).to.eql(\"2021-07-31\");\r", + "});\r", + "\r", + "pm.test(\"note is pagamentoTest\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.note).to.eql(\"pagamentoTest\");\r", + "});\r", + "\r", + "pm.test(\"description is Pagamento di Test\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.description).to.eql(\"Pagamento di Test\");\r", + "});\r", + "\r", + "pm.test(\"company is companyName\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.company).to.eql(\"companyName\");\r", + "});\r", + "\r", + "pm.test(\"office is officeName\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.office).to.eql(\"officeName\");\r", + "});\r", + "\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + }, + { + "key": "MerchantId", + "value": "{{merchant_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:paTaxCode/:noticeNumber", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":paTaxCode", + ":noticeNumber" + ], + "variable": [ + { + "key": "paTaxCode", + "value": "{{pa_tax_code}}" + }, + { + "key": "noticeNumber", + "value": "{{notice_number}}" + } + ] + } + }, + "response": [] + }, + { + "name": "2. Attivazione Avviso", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Outcome is OK\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.outcome).to.eql(\"OK\");\r", + "});\r", + "\r", + "pm.test(\"amount is 10099\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.amount).to.eql(10099);\r", + "});\r", + "\r", + "pm.test(\"paTaxCode is 77777777777\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.paTaxCode).to.eql(\"77777777777\");\r", + "});\r", + "\r", + "pm.test(\"paymentToken is 3a254e00347d4f29a3607a35d780faac\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.paymentToken).to.eql(\"3a254e00347d4f29a3607a35d780faac\");\r", + "});\r", + "\r", + "pm.test(\"transfers is present\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.transfers).to.have;\r", + "});\r", + "\r", + "var paymentToken = _.get(pm.response.json(), \"paymentToken\");\r", + "console.log(\"paymentToken -> \" + paymentToken);\r", + "if (paymentToken) {\r", + " pm.collectionVariables.set(\"paymentToken\", paymentToken);\r", + "}\r", + "\r", + "var totalAmount = _.get(pm.response.json(), \"amount\");\r", + "console.log(\"totalAmount -> \" + totalAmount);\r", + "if (paymentToken) {\r", + " pm.collectionVariables.set(\"totalAmount\", totalAmount);\r", + "}\r", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment')\r", + "var uuid = require('uuid')\r", + "\r", + "var transactionId = uuid.v4().replace(/-/g, '');\r", + "console.log(\"transactionId ->\" + transactionId);\r", + "pm.collectionVariables.set(\"transactionId\", transactionId);\r", + "\r", + "var timestampOp = moment().utc().format('YYYY-MM-DDTHH:mm:ss');\r", + "console.log(\"timestampOp ->\" + timestampOp);\r", + "pm.collectionVariables.set(\"timestampOp\", timestampOp);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"idempotencyKey\": \"77777777777_abcDEF1238\",\r\n \"amount\": 10000\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/paymentNotices/:paTaxCode/:noticeNumber", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "paymentNotices", + ":paTaxCode", + ":noticeNumber" + ], + "variable": [ + { + "key": "paTaxCode", + "value": "{{pa_tax_code}}" + }, + { + "key": "noticeNumber", + "value": "{{notice_number}}" + } + ] + } + }, + "response": [] + }, + { + "name": "3. Conferma pagamento (OK)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Outcome is OK\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.outcome).to.eql(\"OK\");\r", + "});\r", + "\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentTokens\": [\r\n \"{{paymentToken}}\"\r\n ],\r\n \"paymentMethod\": \"PAGOBANCOMAT\",\r\n \"transactionId\": \"{{transactionId}}\",\r\n \"totalAmount\": {{totalAmount}},\r\n \"fee\": {{fee}},\r\n \"timestampOp\": \"{{timestampOp}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "4. Recupera stato pagamento (KO)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 404\", function () {\r", + " pm.response.to.have.status(404);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "bcb0e6ab48aa426c8e92625424a1321d" + } + ] + } + }, + "response": [] + }, + { + "name": "5. Aggiorna stato pagamento", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"outcome\": \"OK\",\r\n \"paymentDate\": \"{{timestampOp}}\",\r\n \"payments\": [\r\n {\r\n \"paymentToken\": \"{{paymentToken}}\",\r\n \"description\": \"Health ticket for chest x-ray\",\r\n \"creditorReferenceId\": \"4839d50603fssfW5X\",\r\n \"fiscalCode\": \"{{pa_tax_code}}\",\r\n \"company\": \"ASL Roma\",\r\n \"office\": \"Ufficio di Roma\",\r\n \"debtor\": \"Mario Rossi\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "{{transactionId}}" + } + ] + } + }, + "response": [] + }, + { + "name": "6. Recupera stato pagamento (OK)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "RequestId", + "value": "{{$guid}}", + "type": "text" + }, + { + "key": "Version", + "value": "{{mil_payment_notice_api_version}}", + "type": "text" + }, + { + "key": "AcquirerId", + "value": "{{acquirer_id}}", + "type": "text" + }, + { + "key": "Channel", + "value": "{{channel}}", + "type": "text" + }, + { + "key": "TerminalId", + "value": "{{terminal_id}}", + "type": "text" + } + ], + "url": { + "raw": "{{MIL_PAYMENT_NOTICE_BASE_URL}}/payments/:transactionId", + "host": [ + "{{MIL_PAYMENT_NOTICE_BASE_URL}}" + ], + "path": [ + "payments", + ":transactionId" + ], + "variable": [ + { + "key": "transactionId", + "value": "{{transactionId}}" + } + ] + } + }, + "response": [] + } + ] + } + ] + } + ], + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{APIM_SUBSCRIPTION_KEY}}", + "type": "string" + }, + { + "key": "key", + "value": "Ocp-Apim-Subscription-Key", + "type": "string" + } + ] + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "mil_payment_notice_api_version", + "value": "1.0.0", + "type": "string" + }, + { + "key": "channel", + "value": "POS", + "type": "string" + }, + { + "key": "pa_tax_code", + "value": "77777777777", + "type": "string" + }, + { + "key": "notice_number", + "value": "302051234567890124", + "type": "string" + }, + { + "key": "terminal_id", + "value": "4585625", + "type": "string" + }, + { + "key": "merchant_id", + "value": "28405fHfk73x88D", + "type": "string" + }, + { + "key": "qr_code", + "value": "PAGOPA|002|302051234567890125|77777777777|10000", + "type": "string" + }, + { + "key": "idempotency_key", + "value": "77777777777_abcDEF1238", + "type": "string" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/it/wiremock/mappings/GET_milAcquirerConf_404.json b/src/test/resources/it/wiremock/mappings/GET_milAcquirerConf_404.json new file mode 100644 index 0000000..b1c04b9 --- /dev/null +++ b/src/test/resources/it/wiremock/mappings/GET_milAcquirerConf_404.json @@ -0,0 +1,10 @@ +{ + "priority": 100, + "request": { + "method": "GET", + "url": "/mil-acquirer-conf/confs/*" + }, + "response": { + "status": 404 + } +} \ No newline at end of file diff --git a/src/test/resources/it/wiremock/mappings/GET_milAcquirerConf_4585625.json b/src/test/resources/it/wiremock/mappings/GET_milAcquirerConf_4585625.json new file mode 100644 index 0000000..230a79f --- /dev/null +++ b/src/test/resources/it/wiremock/mappings/GET_milAcquirerConf_4585625.json @@ -0,0 +1,27 @@ +{ + "priority": 1, + "request": { + "method": "GET", + "url": "/mil-acquirer-conf/confs/4585625/psp" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "pspConfigForVerifyAndActivate": { + "psp": "AGID_01", + "broker": "97735020584", + "channel": "97735020584_07", + "password": "PLACEHOLDER" + }, + "pspConfigForGetFeeAndClosePayment": { + "psp": "AGID_01", + "broker": "97735020584", + "channel": "97735020584_07", + "password": "PLACEHOLDER" + } + } + } +} \ No newline at end of file diff --git a/src/test/resources/it/wiremock/mappings/POST_closePayment_422.json b/src/test/resources/it/wiremock/mappings/POST_closePayment_422.json index 3018267..933fa80 100644 --- a/src/test/resources/it/wiremock/mappings/POST_closePayment_422.json +++ b/src/test/resources/it/wiremock/mappings/POST_closePayment_422.json @@ -10,7 +10,7 @@ ] }, "response": { - "status": 404, + "status": 422, "headers": { "Content-Type": "application/json" }, diff --git a/src/test/resources/node_error_mapping.csv b/src/test/resources/node_error_mapping.csv new file mode 100644 index 0000000..364f4de --- /dev/null +++ b/src/test/resources/node_error_mapping.csv @@ -0,0 +1,49 @@ +faultCode,originalFaultCode,milOutcome +"PPT_SINTASSI_EXTRAXSD","","WRONG_NOTICE_DATA" +"PPT_PSP_SCONOSCIUTO","","NOTICE_GLITCH" +"PPT_PSP_DISABILITATO","","NOTICE_GLITCH" +"PPT_INTERMEDIARIO_PSP_SCONOSCIUTO","","NOTICE_GLITCH" +"PPT_INTERMEDIARIO_PSP_DISABILITATO","","NOTICE_GLITCH" +"PPT_CANALE_SCONOSCIUTO","","NOTICE_GLITCH" +"PPT_CANALE_DISABILITATO","","NOTICE_GLITCH" +"PPT_AUTENTICAZIONE","","NOTICE_GLITCH" +"PPT_AUTORIZZAZIONE","","NOTICE_GLITCH" +"PPT_DOMINIO_SCONOSCIUTO","","WRONG_NOTICE_DATA" +"PPT_DOMINIO_DISABILITATO","","NOTICE_GLITCH" +"PPT_INTERMEDIARIO_PA_SCONOSCIUTO","","UNEXPECTED_ERROR" +"PPT_INTERMEDIARIO_PA_DISABILITATO","","NOTICE_GLITCH" +"PPT_STAZIONE_INT_PA_DISABILITATA","","NOTICE_GLITCH" +"PPT_STAZIONE_INT_PA_SCONOSCIUTA","","WRONG_NOTICE_DATA" +"PPT_CODIFICA_PSP_SCONOSCIUTA","","NOTICE_GLITCH" +"PPT_SEMANTICA","","NOTICE_GLITCH" +"PPT_PAGAMENTO_IN_CORSO","","PAYMENT_ALREADY_IN_PROGRESS" +"PPT_PAGAMENTO_DUPLICATO","","NOTICE_ALREADY_PAID" +"PPT_ATTIVAZIONE_IN_CORSO","","UNEXPECTED_ERROR" +"PPT_ERRORE_IDEMPOTENZA","","UNEXPECTED_ERROR" +"PPT_STAZIONE_INT_PA_IRRAGGIUNGIBILE","","CREDITOR_PROBLEMS" +"PPT_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO","","UNEXPECTED_ERROR" +"PPT_STAZIONE_INT_PA_TIMEOUT","","CREDITOR_PROBLEMS" +"PPT_ERRORE_EMESSO_DA_PAA","PAA_PAGAMENTO_SCONOSCIUTO","UNKNOWN_NOTICE" +"PPT_ERRORE_EMESSO_DA_PAA","PAA_PAGAMENTO_SCADUTO","EXPIRED_NOTICE" +"PPT_ERRORE_EMESSO_DA_PAA","PAA_PAGAMENTO_ANNULLATO","REVOKED_NOTICE" +"PPT_ERRORE_EMESSO_DA_PAA","","CREDITOR_PROBLEMS" +"PPT_STAZIONE_INT_PA_ERRORE_RESPONSE","","CREDITOR_PROBLEMS" +"PPT_IBAN_NON_CENSITO","","CREDITOR_PROBLEMS" +"PPT_SYSTEM_ERROR","","NOTICE_GLITCH" +"PPT_CANALE_IRRAGGIUNGIBILE","","UNEXPECTED_ERROR" +"PPT_CANALE_SERVIZIO_NONATTIVO","","UNEXPECTED_ERROR" +"PPT_STAZIONE_INT_PA_SERVIZIO_NONATTIVO","","UNEXPECTED_ERROR" +"PPT_CANALE_TIMEOUT","","UNEXPECTED_ERROR" +"PPT_CANALE_ERRORE","","UNEXPECTED_ERROR" +"PPT_CANALE_ERRORE_RESPONSE","","UNEXPECTED_ERROR" +"PPT_ERRORE_EMESSO_DA_PAA","PAA_SEMANTICA","NOTICE_GLITCH" +"PPT_SINTASSI_XSD","","WRONG_NOTICE_DATA" +"PPT_ERRORE_EMESSO_DA_PAA","PAA_SINTASSI_EXTRAXSD","CREDITOR_PROBLEMS" +"PPT_ERRORE_EMESSO_DA_PAA","PAA_SINTASSI_XSD","CREDITOR_PROBLEMS" +"PPT_ERRORE_EMESSO_DA_PAA","PAA_ID_DOMINIO_ERRATO","CREDITOR_PROBLEMS" +"PPT_ERRORE_EMESSO_DA_PAA","PAA_ID_INTERMEDIARIO_ERRATO","CREDITOR_PROBLEMS" +"PPT_ERRORE_EMESSO_DA_PAA","PAA_STAZIONE_INT_ERRATA","CREDITOR_PROBLEMS" +"PPT_ERRORE_EMESSO_DA_PAA","PAA_ATTIVA_RPT_IMPORTO_NON_VALIDO","CREDITOR_PROBLEMS" +"PPT_ERRORE_EMESSO_DA_PAA","PAA_SYSTEM_ERROR","CREDITOR_PROBLEMS" +"PPT_ERRORE_EMESSO_DA_PAA","PAA_PAGAMENTO_IN_CORSO","PAYMENT_ALREADY_IN_PROGRESS" +"PPT_ERRORE_EMESSO_DA_PAA","PAA_PAGAMENTO_DUPLICATO","NOTICE_ALREADY_PAID" \ No newline at end of file