diff --git a/src/main/java/br/com/userede/erede/AbstractTransaction.java b/src/main/java/br/com/userede/erede/AbstractTransaction.java index 0a53aca..58b6b22 100644 --- a/src/main/java/br/com/userede/erede/AbstractTransaction.java +++ b/src/main/java/br/com/userede/erede/AbstractTransaction.java @@ -81,6 +81,15 @@ public class AbstractTransaction { @SerializedName("links") private List links; + @SerializedName("SubMerchant") + private SubMerchant submerchant; + + @SerializedName("PaymentFacilitatorID") + private Long paymentFacilitatorID; + + @SerializedName("IndependentSalesOrganizationID") + private String independentSalesOrganizationID; + private void prepareUrls() { if (urls == null) { urls = new ArrayList<>(); @@ -446,4 +455,32 @@ public AbstractTransaction setLinks(List links) { this.links = links; return this; } + + public SubMerchant getSubmerchant() { + return submerchant; + } + + public AbstractTransaction setSubmerchant(SubMerchant submerchant) { + this.submerchant = submerchant; + return this; + } + + public Long getPaymentFacilitatorID() { + return paymentFacilitatorID; + } + + public AbstractTransaction setPaymentFacilitatorID(Long paymentFacilitatorID) { + this.paymentFacilitatorID = paymentFacilitatorID; + return this; + } + + public String getIndependentSalesOrganizationID() { + return independentSalesOrganizationID; + } + + public AbstractTransaction setIndependentSalesOrganizationID(String independentSalesOrganizationID) { + this.independentSalesOrganizationID = independentSalesOrganizationID; + return this; + } + } diff --git a/src/main/java/br/com/userede/erede/Authorization.java b/src/main/java/br/com/userede/erede/Authorization.java index 8ac849e..0c34208 100644 --- a/src/main/java/br/com/userede/erede/Authorization.java +++ b/src/main/java/br/com/userede/erede/Authorization.java @@ -55,6 +55,9 @@ public class Authorization { @SerializedName("tid") private String tid; + @SerializedName("brand") + private Brand brand; + public String getAffiliation() { return affiliation; } @@ -74,6 +77,13 @@ public Authorization setAmount(int amount) { } public String getAuthorizationCode() { + if (brand != null) { + authorizationCode = brand.getAuthorizationCode(); + } + + if (authorizationCode != null) { + authorizationCode = authorizationCode.isEmpty() ? null : authorizationCode; + } return authorizationCode; } @@ -207,4 +217,13 @@ public Authorization setTid(String tid) { this.tid = tid; return this; } + + public Brand getBrand() { + return brand; + } + + public Authorization setBrand(Brand brand) { + this.brand = brand; + return this; + } } \ No newline at end of file diff --git a/src/main/java/br/com/userede/erede/Brand.java b/src/main/java/br/com/userede/erede/Brand.java new file mode 100644 index 0000000..a58f8b1 --- /dev/null +++ b/src/main/java/br/com/userede/erede/Brand.java @@ -0,0 +1,55 @@ +package br.com.userede.erede; + +import com.google.gson.annotations.SerializedName; + +public class Brand { + + @SerializedName("name") + private String name; + + @SerializedName("returnCode") + private String returnCode; + + @SerializedName("returnMessage") + private String returnMessage; + + @SerializedName("authorizationCode") + private String authorizationCode; + + public String getName() { + return name; + } + + public Brand setName(String name) { + this.name = name; + return this; + } + + public String getReturnCode() { + return returnCode; + } + + public Brand setReturnCode(String returnCode) { + this.returnCode = returnCode; + return this; + } + + public String getReturnMessage() { + return returnMessage; + } + + public Brand setReturnMessage(String returnMessage) { + this.returnMessage = returnMessage; + return this; + } + + public String getAuthorizationCode() { + return authorizationCode; + } + + public Brand setAuthorizationCode(String authorizationCode) { + this.authorizationCode = authorizationCode; + return this; + } + +} diff --git a/src/main/java/br/com/userede/erede/Store.java b/src/main/java/br/com/userede/erede/Store.java index e17d6cb..2ccc692 100644 --- a/src/main/java/br/com/userede/erede/Store.java +++ b/src/main/java/br/com/userede/erede/Store.java @@ -5,6 +5,7 @@ public class Store { private Environment environment; private String filiation; private String token; + private Boolean brandReturnOpen; public Store(String filiation, String token, Environment environment) { this.environment = environment; @@ -42,4 +43,12 @@ public Store setToken(String token) { this.token = token; return this; } + + public Boolean getBrandReturnOpen() { + return brandReturnOpen; + } + + public void setBrandReturnOpen(Boolean brandReturnOpen) { + this.brandReturnOpen = brandReturnOpen; + } } diff --git a/src/main/java/br/com/userede/erede/SubMerchant.java b/src/main/java/br/com/userede/erede/SubMerchant.java new file mode 100644 index 0000000..ec3c815 --- /dev/null +++ b/src/main/java/br/com/userede/erede/SubMerchant.java @@ -0,0 +1,103 @@ +package br.com.userede.erede; + +import com.google.gson.annotations.SerializedName; + +public class SubMerchant { + + @SerializedName("MCC") + private Long mcc; + + @SerializedName("SubMerchantID") + private String submerchantID; + + @SerializedName("Address") + private String address; + + @SerializedName("City") + private String city; + + @SerializedName("State") + private String state; + + @SerializedName("Country") + private String country; + + @SerializedName("Cep") + private String cep; + + @SerializedName("Cnpj") + private String cnpj; + + public Long getMcc() { + return mcc; + } + + public SubMerchant setMcc(Long mcc) { + this.mcc = mcc; + return this; + } + + public String getSubmerchantID() { + return submerchantID; + } + + public SubMerchant setSubmerchantID(String submerchantID) { + this.submerchantID = submerchantID; + return this; + } + + public String getAddress() { + return address; + } + + public SubMerchant setAddress(String address) { + this.address = address; + return this; + } + + public String getCity() { + return city; + } + + public SubMerchant setCity(String city) { + this.city = city; + return this; + } + + public String getState() { + return state; + } + + public SubMerchant setState(String state) { + this.state = state; + return this; + } + + public String getCountry() { + return country; + } + + public SubMerchant setCountry(String country) { + this.country = country; + return this; + } + + public String getCep() { + return cep; + } + + public SubMerchant setCep(String cep) { + this.cep = cep; + return this; + } + + public String getCnpj() { + return cnpj; + } + + public SubMerchant setCnpj(String cnpj) { + this.cnpj = cnpj; + return this; + } + +} diff --git a/src/main/java/br/com/userede/erede/Transaction.java b/src/main/java/br/com/userede/erede/Transaction.java index 3d08d6c..8e74714 100644 --- a/src/main/java/br/com/userede/erede/Transaction.java +++ b/src/main/java/br/com/userede/erede/Transaction.java @@ -14,7 +14,7 @@ public Transaction(double amount, String reference) { setReference(reference); } - public Transaction(int amount, String reference) { + public Transaction(Integer amount, String reference) { setAmount(amount); setReference(reference); } diff --git a/src/main/java/br/com/userede/erede/eRede.java b/src/main/java/br/com/userede/erede/eRede.java index 565fe42..f603472 100644 --- a/src/main/java/br/com/userede/erede/eRede.java +++ b/src/main/java/br/com/userede/erede/eRede.java @@ -1,10 +1,13 @@ package br.com.userede.erede; +import java.io.IOException; +import java.net.URISyntaxException; +import java.util.logging.Logger; + import br.com.userede.erede.service.CancelTransactionService; import br.com.userede.erede.service.CaptureTransactionService; import br.com.userede.erede.service.CreateTransactionService; import br.com.userede.erede.service.GetTransactionService; -import java.util.logging.Logger; public class eRede { @@ -24,54 +27,60 @@ public eRede(Store store, Logger logger) { this.logger = logger; } - public TransactionResponse authorize(Transaction transaction) { + public TransactionResponse authorize(Transaction transaction) throws URISyntaxException, IOException { return create(transaction); } - public TransactionResponse create(Transaction transaction) { + public TransactionResponse create(Transaction transaction) throws URISyntaxException, IOException { CreateTransactionService createTransactionService = new CreateTransactionService(store, transaction, logger); + createTransactionService.setUserAgent(String.format(eRede.USER_AGENT, store.getFiliation())); return createTransactionService.execute(); } - public TransactionResponse cancel(Transaction transaction) { + public TransactionResponse cancel(Transaction transaction) throws IOException, URISyntaxException { CancelTransactionService cancelTransactionService = new CancelTransactionService(store, transaction, logger); + cancelTransactionService.setUserAgent(String.format(eRede.USER_AGENT, store.getFiliation())); return cancelTransactionService.execute(); } - public TransactionResponse capture(Transaction transaction) { + public TransactionResponse capture(Transaction transaction) throws IOException, URISyntaxException { CaptureTransactionService captureTransactionService = new CaptureTransactionService(store, transaction, logger); + captureTransactionService.setUserAgent(String.format(eRede.USER_AGENT, store.getFiliation())); return captureTransactionService.execute(); } - public TransactionResponse get(String tid) { + public TransactionResponse get(String tid) throws IOException, URISyntaxException { GetTransactionService getTransactionService = new GetTransactionService(store, null, logger); getTransactionService.setTid(tid); + getTransactionService.setUserAgent(String.format(eRede.USER_AGENT, store.getFiliation())); return getTransactionService.execute(); } - public TransactionResponse getByReference(String reference) { + public TransactionResponse getByReference(String reference) throws IOException, URISyntaxException { GetTransactionService getTransactionService = new GetTransactionService(store, null, logger); getTransactionService.setReference(reference); + getTransactionService.setUserAgent(String.format(eRede.USER_AGENT, store.getFiliation())); return getTransactionService.execute(); } - public TransactionResponse getRefunds(String tid) { + public TransactionResponse getRefunds(String tid) throws IOException, URISyntaxException { GetTransactionService getTransactionService = new GetTransactionService(store, null, logger); getTransactionService.setTid(tid); getTransactionService.setRefund(true); + getTransactionService.setUserAgent(String.format(eRede.USER_AGENT, store.getFiliation())); return getTransactionService.execute(); } - public TransactionResponse zero(Transaction transaction) { + public TransactionResponse zero(Transaction transaction) throws Exception { transaction.setAmount(0); transaction.capture(); diff --git a/src/main/java/br/com/userede/erede/service/AbstractTransactionService.java b/src/main/java/br/com/userede/erede/service/AbstractTransactionService.java index dc3a9df..ffd429c 100644 --- a/src/main/java/br/com/userede/erede/service/AbstractTransactionService.java +++ b/src/main/java/br/com/userede/erede/service/AbstractTransactionService.java @@ -1,12 +1,5 @@ package br.com.userede.erede.service; -import br.com.userede.erede.Store; -import br.com.userede.erede.Transaction; -import br.com.userede.erede.TransactionResponse; -import br.com.userede.erede.eRede; -import br.com.userede.erede.service.error.RedeError; -import br.com.userede.erede.service.error.RedeException; -import com.google.gson.Gson; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -17,6 +10,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.zip.GZIPInputStream; + import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpHeaders; @@ -25,10 +19,19 @@ import org.apache.http.client.utils.URIBuilder; import org.apache.http.impl.client.HttpClientBuilder; +import com.google.gson.Gson; + +import br.com.userede.erede.Store; +import br.com.userede.erede.Transaction; +import br.com.userede.erede.TransactionResponse; +import br.com.userede.erede.service.error.RedeError; +import br.com.userede.erede.service.error.RedeException; + abstract class AbstractTransactionService { final Store store; final Transaction transaction; + private String userAgent; private final Logger logger; @@ -38,48 +41,36 @@ abstract class AbstractTransactionService { this.logger = logger; } - abstract public TransactionResponse execute(); + public abstract TransactionResponse execute() throws URISyntaxException, IOException; URIBuilder getUri() throws URISyntaxException { return new URIBuilder(store.getEnvironment().getEndpoint("transactions")); } - TransactionResponse sendRequest(HttpUriRequest request) { - String credentials = Base64.getEncoder() - .encodeToString(String.format("%s:%s", store.getFiliation(), store.getToken()).getBytes( - StandardCharsets.US_ASCII)); - - request - .addHeader(HttpHeaders.USER_AGENT, String.format(eRede.USER_AGENT, store.getFiliation())); - request.addHeader(HttpHeaders.ACCEPT, "application/json"); - request.addHeader(HttpHeaders.CONTENT_TYPE, "application/json"); - request.addHeader(HttpHeaders.AUTHORIZATION, "Basic " + credentials); + TransactionResponse sendRequest(HttpUriRequest request) throws IOException { + String credentials = Base64.getEncoder().encodeToString( + String.format("%s:%s", store.getFiliation(), store.getToken()).getBytes(StandardCharsets.US_ASCII)); - logger.log(Level.FINE, request.getRequestLine().toString()); + request.addHeader(HttpHeaders.USER_AGENT, this.userAgent); + request.addHeader(HttpHeaders.ACCEPT, "application/json"); + request.addHeader(HttpHeaders.CONTENT_TYPE, "application/json"); + request.addHeader(HttpHeaders.AUTHORIZATION, "Basic " + credentials); + if (store.getBrandReturnOpen()) { + request.addHeader("Transaction-Response", "brand-return-opened"); + } - try { - HttpResponse httpResponse = HttpClientBuilder.create().build().execute(request); - int status = httpResponse.getStatusLine().getStatusCode(); + System.out.println("line:" + request.getRequestLine().toString()); + logger.log(Level.FINE, request.getRequestLine().toString()); - String response = parseResponse(httpResponse); - TransactionResponse transactionResponse = new Gson() - .fromJson(response, TransactionResponse.class); + HttpResponse httpResponse = HttpClientBuilder.create().build().execute(request); - if (status < 200 || status >= 400) { - RedeError redeError = new RedeError(transactionResponse.getReturnCode(), - transactionResponse.getReturnMessage()); + String response = parseResponse(httpResponse); + logger.log(Level.INFO, "REDE Transaction Response:[{0}]", response); - throw new RedeException(httpResponse.getStatusLine().toString(), redeError, - transactionResponse); - } + TransactionResponse transactionResponse = new Gson().fromJson(response, TransactionResponse.class); - return transactionResponse; - } catch (IOException e) { - e.printStackTrace(); - } - - return null; - } + return transactionResponse; + } private String parseResponse(HttpResponse response) throws IOException { HttpEntity responseEntity = response.getEntity(); @@ -102,4 +93,9 @@ private String parseResponse(HttpResponse response) throws IOException { return responseBuilder.toString(); } + + public void setUserAgent(String userAgent) { + this.userAgent = userAgent; + } + } diff --git a/src/main/java/br/com/userede/erede/service/CancelTransactionService.java b/src/main/java/br/com/userede/erede/service/CancelTransactionService.java index 7e390a8..1487300 100644 --- a/src/main/java/br/com/userede/erede/service/CancelTransactionService.java +++ b/src/main/java/br/com/userede/erede/service/CancelTransactionService.java @@ -4,9 +4,10 @@ import br.com.userede.erede.Transaction; import br.com.userede.erede.TransactionResponse; import com.google.gson.GsonBuilder; -import java.io.UnsupportedEncodingException; +import java.io.IOException; import java.net.URISyntaxException; import java.util.logging.Logger; + import org.apache.http.client.methods.HttpPost; import org.apache.http.client.utils.URIBuilder; import org.apache.http.entity.StringEntity; @@ -27,18 +28,10 @@ public URIBuilder getUri() throws URISyntaxException { } @Override - public TransactionResponse execute() { - try { - HttpPost request = new HttpPost(getUri().build()); - String entity = new GsonBuilder().create().toJson(transaction); - - request.setEntity(new StringEntity(entity)); - - return sendRequest(request); - } catch (URISyntaxException | UnsupportedEncodingException e) { - e.printStackTrace(); - } - - return null; + public TransactionResponse execute() throws IOException, URISyntaxException { + HttpPost request = new HttpPost(getUri().build()); + String entity = new GsonBuilder().create().toJson(transaction); + request.setEntity(new StringEntity(entity)); + return sendRequest(request); } } diff --git a/src/main/java/br/com/userede/erede/service/CaptureTransactionService.java b/src/main/java/br/com/userede/erede/service/CaptureTransactionService.java index 23573c5..c64de32 100644 --- a/src/main/java/br/com/userede/erede/service/CaptureTransactionService.java +++ b/src/main/java/br/com/userede/erede/service/CaptureTransactionService.java @@ -4,13 +4,16 @@ import br.com.userede.erede.Transaction; import br.com.userede.erede.TransactionResponse; import com.google.gson.GsonBuilder; -import java.io.UnsupportedEncodingException; +import java.io.IOException; import java.net.URISyntaxException; import java.util.logging.Logger; + import org.apache.http.client.methods.HttpPut; import org.apache.http.client.utils.URIBuilder; import org.apache.http.entity.StringEntity; + + public class CaptureTransactionService extends AbstractTransactionService { public CaptureTransactionService(Store store, @@ -26,18 +29,10 @@ public URIBuilder getUri() throws URISyntaxException { } @Override - public TransactionResponse execute() { - try { - HttpPut request = new HttpPut(getUri().build()); - String entity = new GsonBuilder().create().toJson(transaction); - - request.setEntity(new StringEntity(entity)); - - return sendRequest(request); - } catch (URISyntaxException | UnsupportedEncodingException e) { - e.printStackTrace(); - } - - return null; + public TransactionResponse execute() throws IOException, URISyntaxException { + HttpPut request = new HttpPut(getUri().build()); + String entity = new GsonBuilder().create().toJson(transaction); + request.setEntity(new StringEntity(entity)); + return sendRequest(request); } } diff --git a/src/main/java/br/com/userede/erede/service/CreateTransactionService.java b/src/main/java/br/com/userede/erede/service/CreateTransactionService.java index ea0f492..e71f879 100644 --- a/src/main/java/br/com/userede/erede/service/CreateTransactionService.java +++ b/src/main/java/br/com/userede/erede/service/CreateTransactionService.java @@ -3,13 +3,16 @@ import br.com.userede.erede.Store; import br.com.userede.erede.Transaction; import br.com.userede.erede.TransactionResponse; +import java.io.IOException; import com.google.gson.GsonBuilder; -import java.io.UnsupportedEncodingException; import java.net.URISyntaxException; +import java.nio.charset.StandardCharsets; import java.util.logging.Logger; + import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; + public class CreateTransactionService extends AbstractTransactionService { public CreateTransactionService(Store store, Transaction transaction, Logger logger) { @@ -17,18 +20,11 @@ public CreateTransactionService(Store store, Transaction transaction, Logger log } @Override - public TransactionResponse execute() { - try { - HttpPost request = new HttpPost(getUri().build()); - String entity = new GsonBuilder().create().toJson(transaction); - - request.setEntity(new StringEntity(entity)); - - return sendRequest(request); - } catch (URISyntaxException | UnsupportedEncodingException e) { - e.printStackTrace(); - } - - return null; + public TransactionResponse execute() throws URISyntaxException, IOException { + HttpPost request; + request = new HttpPost(getUri().build()); + String entity = new GsonBuilder().create().toJson(transaction); + request.setEntity(new StringEntity(entity, StandardCharsets.UTF_8)); + return sendRequest(request); } } diff --git a/src/main/java/br/com/userede/erede/service/GetTransactionService.java b/src/main/java/br/com/userede/erede/service/GetTransactionService.java index d491353..99ab63b 100644 --- a/src/main/java/br/com/userede/erede/service/GetTransactionService.java +++ b/src/main/java/br/com/userede/erede/service/GetTransactionService.java @@ -3,8 +3,10 @@ import br.com.userede.erede.Store; import br.com.userede.erede.Transaction; import br.com.userede.erede.TransactionResponse; +import java.io.IOException; import java.net.URISyntaxException; import java.util.logging.Logger; + import org.apache.http.client.methods.HttpGet; import org.apache.http.client.utils.URIBuilder; @@ -47,15 +49,8 @@ public URIBuilder getUri() throws URISyntaxException { } @Override - public TransactionResponse execute() { - try { + public TransactionResponse execute() throws IOException, URISyntaxException { HttpGet request = new HttpGet(getUri().build()); - return sendRequest(request); - } catch (URISyntaxException e) { - e.printStackTrace(); - } - - return null; } } diff --git a/src/test/java/br/com/userede/erede/TestAuthorization.java b/src/test/java/br/com/userede/erede/TestAuthorization.java new file mode 100644 index 0000000..ce2b143 --- /dev/null +++ b/src/test/java/br/com/userede/erede/TestAuthorization.java @@ -0,0 +1,74 @@ +package br.com.userede.erede; + +import com.google.gson.Gson; + +import junit.framework.TestCase; + +public class TestAuthorization extends TestCase { + + String auth = " { \"dateTime\": \"2020-12-14T19:26:17-03:00\",\n" + + " \"returnCode\": \"00\",\n" + + " \"returnMessage\": \"Success.\",\n" + + " \"affiliation\": 11223344,\n" + + " \"status\": \"Approved\",\n" + + " \"reference\": \"1234\",\n" + + " \"tid\": \"10012012141925580147\",\n" + + " \"nsu\": \"504364149\",\n" + + " \"kind\": \"Credit\",\n" + + " \"amount\": 51,\n" + + " \"installments\": 1,\n" + + " \"cardHolderName\": \"Jhon Dole\",\n" + + " \"cardBin\": \"112233\",\n" + + " \"last4\": \"1234\",\n" + + " \"origin\": 1,\n" + + " \"subscription\": false,\n" + + " \"brand\": {\n" + + " \"name\": \"Mastercard\",\n" + + " \"returnCode\": \"00\",\n" + + " \"returnMessage\": \"Success.\",\n" + + " \"authorizationCode\": \"031605\",\n" + + " \"brandTid\": \"031605\"\n" + + " } }"; + + private Authorization authorization = new Authorization(); + private Gson gson = new Gson(); + + public void testGetAuthorizationCode() { + authorization = gson.fromJson(auth, Authorization.class); + assertEquals("031605", authorization.getAuthorizationCode()); + + auth = " { " + + " \"brand\": {\n" + + " \"name\": \"Mastercard\",\n" + + " \"returnCode\": \"00\",\n" + + " \"returnMessage\": \"Success.\",\n" + + " \"brandTid\": \"031605\"\n" + + " } }"; + authorization = gson.fromJson(auth, Authorization.class); + assertEquals(null, authorization.getAuthorizationCode()); + + auth = " { \"authorizationCode\": \"\"\n } "; + authorization = gson.fromJson(auth, Authorization.class); + assertEquals(null, authorization.getBrand()); + assertEquals(null, authorization.getAuthorizationCode()); + + auth = " { \"authorizationCode\": \"112233\"\n } "; + authorization = gson.fromJson(auth, Authorization.class); + assertEquals(null, authorization.getBrand()); + assertEquals("112233", authorization.getAuthorizationCode()); + + } + +// public void testSetAuthorizationCode() { +// fail("Not yet implemented"); +// } +// +// public void testGetBrand() { +// fail("Not yet implemented"); +// } +// +// public void testSetBrand() { +// fail("Not yet implemented"); +// } + +} diff --git a/src/test/java/br/com/userede/erede/TestErede.java b/src/test/java/br/com/userede/erede/TestErede.java new file mode 100644 index 0000000..14a64b3 --- /dev/null +++ b/src/test/java/br/com/userede/erede/TestErede.java @@ -0,0 +1,38 @@ +package br.com.userede.erede; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.util.Random; + +import com.google.gson.Gson; + +public class TestErede { + + public static void main(String[] args) throws URISyntaxException, IOException { + // Replace "PV" and "token" + Store store = new Store("PV", "TOKEN", Environment.sandbox()); + + // Ativa retorno das bandeiras. + store.setBrandReturnOpen(true); + Gson gson = new Gson(); + + // Transação que será autorizada + Integer randnum = new Random().nextInt(10000 - 100) + 100; + Transaction transaction = new Transaction(new Integer(2092), "pedido" + randnum.toString()); + transaction.creditCard("5448280000000007", "123", "12", "2028", "Jhon James Rambo"); + + System.out.println("Transação original: \n" + gson.toJson(transaction)); + + // Autoriza a transação + TransactionResponse transactionResp; + transactionResp = (new eRede(store).create(transaction)); + + if (transactionResp.getReturnCode().equals("00")) { + System.out.printf("Transação autorizada com sucesso: %s\n", transactionResp.getTid()); + } + + // Consulta a transação + TransactionResponse transactionResponse = (new eRede(store).get(transactionResp.getTid())); + System.out.println("Consulta:\n" + gson.toJson(transactionResponse)); + } +}