Skip to content

Commit

Permalink
Merge pull request #13 from maxipago/GTMP-2089_Correcao_da_mensagem_d…
Browse files Browse the repository at this point in the history
…e_erro

[GTMP-2089] Correção da mensagem de erro
  • Loading branch information
Vinicius-Brito-Costa authored Jun 13, 2023
2 parents cb9f367 + a7f76d0 commit e084185
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [2.1.3] - 12/JUN/2023
### Changed
- Correcao da mensagem de erro

## [2.1.2] - 07/JUN/2023
### Added
- Consulta por reference number
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.maxipago</groupId>
<artifactId>sdk-java-v2</artifactId>
<version>2.1.2</version>
<version>2.1.3</version>

<build>
<plugins>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/maxipago/request/TransactionResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class TransactionResponse {
public String creditCardBin;
public String creditCardLast4;
public String errorMessage;
public String errorMsg;
public String errorCode;
public String processorTransactionID;
public String processorReferenceNumber;
public String creditCardScheme;
Expand Down
33 changes: 33 additions & 0 deletions src/test/java/com/maxipago/MaxiPagoTestWiremock.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.io.BufferedReader;
import java.io.File;
Expand All @@ -13,6 +14,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.xml.bind.PropertyException;

import org.apache.commons.lang.StringUtils;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
Expand Down Expand Up @@ -40,6 +42,7 @@ public class MaxiPagoTestWiremock {
private static String RAPI_RESPONSE="rapiResponse.xml";
private static String CARDONFILE_RESPONSE="cardOnFileResponse.xml";
private static String SALE_DECLINED_RESPONSE="saleDeclinedResponse.xml";
private static String AUTH_ERROR_RESPONSE="authErrorResponse.xml";
private static String UNIVERSAL_API="/UniversalAPI/postXML";
private static String REPORTS_API="/ReportsAPI/servlet/ReportsAPI";
private static final String RAPI_REFERENCE_NUMBER = "2023059999355845";
Expand Down Expand Up @@ -1066,6 +1069,36 @@ public void shouldConsultOrderByReferenceNumRange() {
}
Assert.assertTrue(rightRecord);
}

@Test
public void invalidProcessorIdTest(){
MaxiPago maxiPago = prepareResponse(AUTH_ERROR_RESPONSE, UNIVERSAL_API);
maxiPago.auth()
.setProcessorId("0")
.setReferenceNum("CreateAuth")
.setIpAddress("127.0.0.1")
.billingAndShipping((new Customer())
.setName("Nome como esta gravado no cartao")
.setAddress("Rua Volkswagen, 100")
.setAddress2("0")
.setDistrict("Jabaquara")
.setCity("Sao Paulo")
.setState("SP")
.setPostalCode("11111111")
.setCountry("BR")
.setPhone("11111111111")
.setEmail("[email protected]"))
.setCreditCard((new Card())
.setNumber("5448280000000007")
.setExpMonth("12")
.setExpYear("2028")
.setCvvNumber("123"))
.setPayment(new Payment(100.0));

TransactionResponse response = maxiPago.transactionRequest().execute();
assertTrue(StringUtils.isNotBlank(response.errorMsg));
assertEquals("1", response.errorCode);
}

private String getXMLContextToParse(String strfile) {
StringBuilder xmlData = new StringBuilder();
Expand Down
5 changes: 5 additions & 0 deletions src/test/resources/authErrorResponse.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<api-error>
<errorCode>1</errorCode>
<errorMsg><![CDATA[Schema validation for the vertical SA for the incoming transaction xml failed. Reason Parser Error: URI=null Line=1: cvc-minInclusive-valid: Value '0' is not facet-valid with respect to minInclusive '1' for type 'positiveInteger'.]]></errorMsg>
</api-error>

0 comments on commit e084185

Please sign in to comment.