Skip to content

Commit

Permalink
Merge pull request #15 from maxipago/inclusao_das_tags_responseMode_e…
Browse files Browse the repository at this point in the history
…_sendNotification_no_3DS

Inclusão do sendNotification e responseMode no 3DS para callback
  • Loading branch information
santanabeto authored Nov 30, 2023
2 parents b924768 + 99114ec commit e3db26d
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 26 deletions.
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.5] - 29/NOV/2023
### Added
- Inclusão do sendNotification e responseMode no 3DS para callback

## [2.1.4] - 10/JUL/2023
### Fix
- Mudanca de referenceNumber para referenceNum
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.4</version>
<version>2.1.5</version>

<build>
<plugins>
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/com/maxipago/Authentication.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
public class Authentication {
public static String DECLINE = "decline";
public static String CONTINUE = "continue";
public ChallengePreference challengePreference = ChallengePreference.NO_PREFERENCE;
public ChallengePreference challengePreference = ChallengePreference.NO_PREFERENCE;

@XmlElement
public String mpiProcessorID;

@XmlElement
public String onFailure;
@XmlElement
public String responseMode;
@XmlElement
public String sendNotification;

public Authentication() {
}
Expand All @@ -35,6 +38,14 @@ public Authentication(String mpiProcessorID, String onFailure, ChallengePreferen
this.onFailure = onFailure;
this.challengePreference = challengePreference;
}

public Authentication(String mpiProcessorID, String onFailure, ChallengePreference challengePreference,String responseMode, String sendNotification) {
this.mpiProcessorID = mpiProcessorID;
this.onFailure = onFailure;
this.challengePreference = challengePreference;
this.responseMode = responseMode;
this.sendNotification = sendNotification;
}

public Authentication setOnFailure(String onFailure) {
this.onFailure = onFailure;
Expand Down
18 changes: 14 additions & 4 deletions src/main/java/com/maxipago/Transaction.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package com.maxipago;

import com.maxipago.enums.ChallengePreference;
import com.maxipago.paymentmethod.*;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import java.util.ArrayList;

import com.maxipago.enums.ChallengePreference;
import com.maxipago.paymentmethod.Boleto;
import com.maxipago.paymentmethod.Card;
import com.maxipago.paymentmethod.OnlineDebit;
import com.maxipago.paymentmethod.PayType;
import com.maxipago.paymentmethod.Pix;
import com.maxipago.paymentmethod.Token;

@XmlSeeAlso({PayType.class, FraudDetails.class})
public class Transaction {
Expand Down Expand Up @@ -108,6 +112,11 @@ public Transaction setAuthentication(String mpiProcessorID, String onFailure, Ch
this.authentication = new Authentication(mpiProcessorID, onFailure, challengePreference);
return this;
}

public Transaction setAuthentication(String mpiProcessorID, String onFailure, ChallengePreference challengePreference, String responseMode, String sendNotification) {
this.authentication = new Authentication(mpiProcessorID, onFailure, challengePreference,responseMode, sendNotification);
return this;
}

public Transaction setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
Expand Down Expand Up @@ -143,6 +152,7 @@ public Transaction billingAndShipping(Customer customer) {

public Transaction setBilling(Customer billing) {
this.billing = billing;

return this;
}

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/maxipago/request/AbstractRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ public B execute() {
.setCookieSpec(CookieSpecs.IGNORE_COOKIES)
.build();

// Logger.getLogger("SDK-Java").info(writer.toString());

httpPost.setEntity(new StringEntity(writer.toString(), encode));
httpPost.setConfig(params);

Expand Down
19 changes: 3 additions & 16 deletions src/main/java/com/maxipago/request/TransactionRequest.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
package com.maxipago.request;

import com.maxipago.Environment;
import com.maxipago.Order;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import com.maxipago.Environment;
import com.maxipago.Order;

@XmlRootElement(name = "transaction-request")
public class TransactionRequest extends AbstractRequest<TransactionRequest, TransactionResponse> {
Expand All @@ -23,12 +12,10 @@ public class TransactionRequest extends AbstractRequest<TransactionRequest, Tran

private Order order;

public TransactionRequest() {
}
public TransactionRequest() {}

public TransactionRequest(Environment environment) {
super(environment);

order = new Order();
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/maxipago/MaxiPagoTestWiremock.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void shouldCreateSaleWith3DS() throws PropertyException {
maxiPago.sale()
.setProcessorId("5")
.setReferenceNum("CreateSaleWith3DS")
.setAuthentication("41", Authentication.DECLINE, ChallengePreference.NO_PREFERENCE)
.setAuthentication("41", Authentication.DECLINE, ChallengePreference.NO_PREFERENCE, "POSTBACK", "Y")
.setUserAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36")
.device(new Device()
.setColorDepth("1")
Expand Down

0 comments on commit e3db26d

Please sign in to comment.