-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Mensageria SDWO * Pom e Readme * Purchase e Cash-in
- Loading branch information
1 parent
e3db26d
commit a4e9c7a
Showing
9 changed files
with
199 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -477,6 +477,51 @@ maxiPago.sale() | |
TransactionResponse response = maxiPago.transactionRequest().execute(); | ||
``` | ||
|
||
#### Venda direta com Autenticação 3DS V2 e SDWO (cartão de crédito e débito) | ||
```java | ||
MaxiPago maxiPago = new MaxiPago(environment); | ||
|
||
maxiPago.sale() | ||
.setProcessorId("5") | ||
.setReferenceNum("CreateSaleWith3DS") | ||
.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") | ||
.setJavaEnabled(true) | ||
.setLanguage("BR") | ||
.setScreenHeight("550") | ||
.setScreenWidth("550") | ||
.setTimeZoneOffset(3)) | ||
.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("5221834791042066") | ||
.setExpMonth("12") | ||
.setExpYear("2030") | ||
.setCvvNumber("123")) | ||
.setPayment(new Payment(100.0)) | ||
.setWallet(new Wallet() | ||
.setSDWO(new SDWO() | ||
.setId(12345) | ||
.setProcessingType(SDWOProcessingType.CASH_IN) | ||
.setSenderTaxIdentification("56326738000106") | ||
.setBusinessApplicationIdentifier(BusinessApplicationIdentifier.CBPS))); | ||
|
||
|
||
TransactionResponse response = maxiPago.transactionRequest().execute(); | ||
``` | ||
|
||
#### Criando um Pix | ||
```java | ||
MaxiPago maxiPago = new MaxiPago(environment); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.maxipago; | ||
|
||
import javax.xml.bind.annotation.XmlElement; | ||
|
||
import com.maxipago.enums.BusinessApplicationIdentifier; | ||
import com.maxipago.enums.SDWOProcessingType; | ||
|
||
public class SDWO { | ||
@XmlElement | ||
public int id; | ||
@XmlElement | ||
public String processingType; | ||
@XmlElement | ||
public String senderTaxIdentification; | ||
@XmlElement | ||
public String businessApplicationIdentifier; | ||
|
||
public SDWO setId(int id) { | ||
this.id = id; | ||
return this; | ||
} | ||
|
||
public SDWO setProcessingType(SDWOProcessingType processingType) { | ||
this.processingType = processingType.toString(); | ||
return this; | ||
} | ||
|
||
public SDWO setSenderTaxIdentification(String senderTaxIdentification) { | ||
this.senderTaxIdentification = senderTaxIdentification; | ||
return this; | ||
} | ||
|
||
public SDWO setBusinessApplicationIdentifier(BusinessApplicationIdentifier businessApplicationIdentifier) { | ||
this.businessApplicationIdentifier = businessApplicationIdentifier.toString(); | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.maxipago; | ||
|
||
import javax.xml.bind.annotation.XmlElement; | ||
|
||
public class Wallet { | ||
@XmlElement | ||
public String name; | ||
@XmlElement | ||
public SDWO sdwo; | ||
|
||
public Wallet setName(String name) { | ||
this.name = name; | ||
return this; | ||
} | ||
|
||
public Wallet setSDWO(SDWO sdwo) { | ||
this.sdwo = sdwo; | ||
return this; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/maxipago/enums/BusinessApplicationIdentifier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.maxipago.enums; | ||
|
||
public enum BusinessApplicationIdentifier { | ||
CBPS("01"); | ||
|
||
private String identifier; | ||
|
||
BusinessApplicationIdentifier(String identifier){ | ||
this.identifier = identifier; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.identifier; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.maxipago.enums; | ||
|
||
public enum SDWOProcessingType { | ||
PURCHASE("Purchase"), CASH_IN("Cash-in"); | ||
|
||
private String processingType; | ||
|
||
SDWOProcessingType(String processingType){ | ||
this.processingType = processingType; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.processingType; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,8 +23,10 @@ | |
import org.mockito.junit.MockitoJUnitRunner; | ||
|
||
import com.github.tomakehurst.wiremock.junit.WireMockRule; | ||
import com.maxipago.enums.BusinessApplicationIdentifier; | ||
import com.maxipago.enums.ChallengePreference; | ||
import com.maxipago.enums.ReportsPeriodEnum; | ||
import com.maxipago.enums.SDWOProcessingType; | ||
import com.maxipago.paymentmethod.Boleto; | ||
import com.maxipago.paymentmethod.Card; | ||
import com.maxipago.paymentmethod.OnlineDebit; | ||
|
@@ -1132,4 +1134,49 @@ private MaxiPago prepareResponse(String file, String path) { | |
.withBody(responseXML))); | ||
return maxiPago; | ||
} | ||
|
||
@Test | ||
public void shouldCreateSaleWith3DSAndSDWO() throws PropertyException { | ||
MaxiPago maxiPago = prepareResponse(CAPTURED_RESPONSE, UNIVERSAL_API); | ||
|
||
maxiPago.sale() | ||
.setProcessorId("5") | ||
.setReferenceNum("CreateSaleWith3DS") | ||
.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") | ||
.setJavaEnabled(true) | ||
.setLanguage("BR") | ||
.setScreenHeight("550") | ||
.setScreenWidth("550") | ||
.setTimeZoneOffset(3)) | ||
.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("5221834791042066") | ||
.setExpMonth("12") | ||
.setExpYear("2030") | ||
.setCvvNumber("123")) | ||
.setPayment(new Payment(100.0)) | ||
.setWallet(new Wallet() | ||
.setSDWO(new SDWO() | ||
.setId(12345) | ||
.setProcessingType(SDWOProcessingType.CASH_IN) | ||
.setSenderTaxIdentification("56326738000106") | ||
.setBusinessApplicationIdentifier(BusinessApplicationIdentifier.CBPS))); | ||
|
||
TransactionResponse response = maxiPago.transactionRequest().execute(); | ||
assertEquals("0", response.responseCode); | ||
} | ||
} |