From babfce7b6385e0c7c63477fcab9eafa55af90693 Mon Sep 17 00:00:00 2001 From: Matias Date: Tue, 28 Jun 2022 17:29:37 -0300 Subject: [PATCH 01/24] First Commit --- .idea/.gitignore | 8 ++ .idea/compiler.xml | 13 ++ .idea/encodings.xml | 7 + .idea/jarRepositories.xml | 20 +++ .idea/misc.xml | 14 ++ .idea/sonarlint/issuestore/index.pb | 0 .idea/uiDesigner.xml | 124 ++++++++++++++++++ .idea/vcs.xml | 6 + pom.xml | 86 ++++++++++++ src/main/java/conekta/io/Startup.java | 9 ++ .../conekta/io/client/ConektaRequestor.java | 27 ++++ .../io/config/ConektaAuthenticator.java | 38 ++++++ .../java/conekta/io/config/Constants.java | 10 ++ src/main/java/conekta/io/config/Headers.java | 9 ++ .../java/conekta/io/model/ConektaModel.java | 13 ++ .../java/conekta/io/model/impl/Balance.java | 4 + .../conekta/io/model/impl/ConektaList.java | 4 + .../java/conekta/io/model/impl/Customer.java | 50 +++++++ src/main/java/conekta/io/model/impl/Log.java | 4 + .../java/conekta/io/model/impl/Order.java | 65 +++++++++ .../conekta/io/model/impl/PaymentLink.java | 4 + src/main/java/conekta/io/model/impl/Plan.java | 4 + .../conekta/io/model/impl/Subscription.java | 4 + .../conekta/io/model/impl/Transaction.java | 4 + .../java/conekta/io/model/impl/Transfer.java | 4 + .../java/conekta/io/model/impl/Webhook.java | 4 + src/main/java/conekta/io/submodel/Charge.java | 4 + .../java/conekta/io/submodel/Discount.java | 4 + .../conekta/io/submodel/PaymentSource.java | 5 + .../java/conekta/io/submodel/Product.java | 4 + .../java/conekta/io/submodel/Shipping.java | 4 + .../conekta/io/submodel/ShippingContact.java | 5 + src/main/java/conekta/io/submodel/Tax.java | 4 + src/test/java/conekta/io/AppTest.java | 20 +++ target/classes/conekta/io/Startup.class | Bin 0 -> 386 bytes .../conekta/io/client/ConektaRequestor.class | Bin 0 -> 1859 bytes .../io/config/ConektaAuthenticator$1.class | Bin 0 -> 847 bytes .../io/config/ConektaAuthenticator.class | Bin 0 -> 926 bytes .../classes/conekta/io/config/Headers.class | Bin 0 -> 282 bytes .../conekta/io/model/ConektaModel.class | Bin 0 -> 233 bytes .../conekta/io/model/impl/Balance.class | Bin 0 -> 688 bytes .../conekta/io/model/impl/Customer.class | Bin 0 -> 293 bytes .../classes/conekta/io/model/impl/List.class | Bin 0 -> 281 bytes .../classes/conekta/io/model/impl/Log.class | Bin 0 -> 278 bytes .../classes/conekta/io/model/impl/Order.class | Bin 0 -> 284 bytes .../conekta/io/model/impl/PaymentLink.class | Bin 0 -> 302 bytes .../classes/conekta/io/model/impl/Plan.class | Bin 0 -> 281 bytes .../conekta/io/model/impl/Subscription.class | Bin 0 -> 305 bytes .../conekta/io/model/impl/Transaction.class | Bin 0 -> 302 bytes .../conekta/io/model/impl/Transfer.class | Bin 0 -> 293 bytes .../conekta/io/model/impl/Webhook.class | Bin 0 -> 290 bytes 51 files changed, 585 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/compiler.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/sonarlint/issuestore/index.pb create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/vcs.xml create mode 100644 pom.xml create mode 100644 src/main/java/conekta/io/Startup.java create mode 100644 src/main/java/conekta/io/client/ConektaRequestor.java create mode 100644 src/main/java/conekta/io/config/ConektaAuthenticator.java create mode 100644 src/main/java/conekta/io/config/Constants.java create mode 100644 src/main/java/conekta/io/config/Headers.java create mode 100644 src/main/java/conekta/io/model/ConektaModel.java create mode 100644 src/main/java/conekta/io/model/impl/Balance.java create mode 100644 src/main/java/conekta/io/model/impl/ConektaList.java create mode 100644 src/main/java/conekta/io/model/impl/Customer.java create mode 100644 src/main/java/conekta/io/model/impl/Log.java create mode 100644 src/main/java/conekta/io/model/impl/Order.java create mode 100644 src/main/java/conekta/io/model/impl/PaymentLink.java create mode 100644 src/main/java/conekta/io/model/impl/Plan.java create mode 100644 src/main/java/conekta/io/model/impl/Subscription.java create mode 100644 src/main/java/conekta/io/model/impl/Transaction.java create mode 100644 src/main/java/conekta/io/model/impl/Transfer.java create mode 100644 src/main/java/conekta/io/model/impl/Webhook.java create mode 100644 src/main/java/conekta/io/submodel/Charge.java create mode 100644 src/main/java/conekta/io/submodel/Discount.java create mode 100644 src/main/java/conekta/io/submodel/PaymentSource.java create mode 100644 src/main/java/conekta/io/submodel/Product.java create mode 100644 src/main/java/conekta/io/submodel/Shipping.java create mode 100644 src/main/java/conekta/io/submodel/ShippingContact.java create mode 100644 src/main/java/conekta/io/submodel/Tax.java create mode 100644 src/test/java/conekta/io/AppTest.java create mode 100644 target/classes/conekta/io/Startup.class create mode 100644 target/classes/conekta/io/client/ConektaRequestor.class create mode 100644 target/classes/conekta/io/config/ConektaAuthenticator$1.class create mode 100644 target/classes/conekta/io/config/ConektaAuthenticator.class create mode 100644 target/classes/conekta/io/config/Headers.class create mode 100644 target/classes/conekta/io/model/ConektaModel.class create mode 100644 target/classes/conekta/io/model/impl/Balance.class create mode 100644 target/classes/conekta/io/model/impl/Customer.class create mode 100644 target/classes/conekta/io/model/impl/List.class create mode 100644 target/classes/conekta/io/model/impl/Log.class create mode 100644 target/classes/conekta/io/model/impl/Order.class create mode 100644 target/classes/conekta/io/model/impl/PaymentLink.class create mode 100644 target/classes/conekta/io/model/impl/Plan.class create mode 100644 target/classes/conekta/io/model/impl/Subscription.class create mode 100644 target/classes/conekta/io/model/impl/Transaction.class create mode 100644 target/classes/conekta/io/model/impl/Transfer.class create mode 100644 target/classes/conekta/io/model/impl/Webhook.class diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..41e5941 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..712ab9d --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d24ea8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/sonarlint/issuestore/index.pb b/.idea/sonarlint/issuestore/index.pb new file mode 100644 index 0000000..e69de29 diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..135d8e7 --- /dev/null +++ b/pom.xml @@ -0,0 +1,86 @@ + + + + 4.0.0 + + conekta.io + ct-conekta-java + 1.0-SNAPSHOT + + ct-conekta-java + This is a java library that allows interaction with https://api.conekta.io API. + https://www.conekta.io + + + UTF-8 + 11 + 11 + + + + + com.fasterxml.jackson.jr + jackson-jr-objects + 2.13.3 + + + junit + junit + 4.13.2 + test + + + org.projectlombok + lombok + 1.18.24 + provided + + + + + + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + + maven-surefire-plugin + 2.22.1 + + + maven-jar-plugin + 3.0.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + maven-site-plugin + 3.7.1 + + + maven-project-info-reports-plugin + 3.0.0 + + + + + diff --git a/src/main/java/conekta/io/Startup.java b/src/main/java/conekta/io/Startup.java new file mode 100644 index 0000000..89293f4 --- /dev/null +++ b/src/main/java/conekta/io/Startup.java @@ -0,0 +1,9 @@ +package conekta.io; + +public class Startup { + + public static void main(String[] args) { + + } + +} diff --git a/src/main/java/conekta/io/client/ConektaRequestor.java b/src/main/java/conekta/io/client/ConektaRequestor.java new file mode 100644 index 0000000..58b724f --- /dev/null +++ b/src/main/java/conekta/io/client/ConektaRequestor.java @@ -0,0 +1,27 @@ +package conekta.io.client; + +import conekta.io.config.ConektaAuthenticator; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +public class ConektaRequestor { + + public HttpResponse send(HttpRequest request){ + try { + return HttpClient.newBuilder() + .authenticator(ConektaAuthenticator.getBasicAuthenticator()) + .connectTimeout(Duration.ofSeconds(15)) + .build() + .send(request, HttpResponse.BodyHandlers.ofString()); + } catch (IOException e) { + throw new RuntimeException(e); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/src/main/java/conekta/io/config/ConektaAuthenticator.java b/src/main/java/conekta/io/config/ConektaAuthenticator.java new file mode 100644 index 0000000..fe47193 --- /dev/null +++ b/src/main/java/conekta/io/config/ConektaAuthenticator.java @@ -0,0 +1,38 @@ +package conekta.io.config; + +import java.net.Authenticator; +import java.net.PasswordAuthentication; + +public class ConektaAuthenticator { + private static String username; + private static String password; + + private ConektaAuthenticator() { + // The only wait to create user and password is to set manually before using the library. + } + + public static Authenticator getBasicAuthenticator(){ + return new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(getUsername(), getPassword().toCharArray()); + } + }; + } + + public static void setUsername(String username) { + ConektaAuthenticator.username = username; + } + + public static void setPassword(String password) { + ConektaAuthenticator.password = password; + } + + public static String getUsername() { + return username; + } + + public static String getPassword() { + return password; + } +} diff --git a/src/main/java/conekta/io/config/Constants.java b/src/main/java/conekta/io/config/Constants.java new file mode 100644 index 0000000..ac041aa --- /dev/null +++ b/src/main/java/conekta/io/config/Constants.java @@ -0,0 +1,10 @@ +package conekta.io.config; + +public class Constants { + + public static final String API_BASE = "https://api.conekta.io"; + public static final String API_VERSION = "2.0.0"; + public static final String VERSION = "2.1.1"; + public static final String LOCALE = "es"; + +} diff --git a/src/main/java/conekta/io/config/Headers.java b/src/main/java/conekta/io/config/Headers.java new file mode 100644 index 0000000..03f2d54 --- /dev/null +++ b/src/main/java/conekta/io/config/Headers.java @@ -0,0 +1,9 @@ +package conekta.io.config; + +import java.net.http.HttpHeaders; + +public class Headers { + public HttpHeaders getHeaders() { + return null; + } +} diff --git a/src/main/java/conekta/io/model/ConektaModel.java b/src/main/java/conekta/io/model/ConektaModel.java new file mode 100644 index 0000000..13f3ffd --- /dev/null +++ b/src/main/java/conekta/io/model/ConektaModel.java @@ -0,0 +1,13 @@ +package conekta.io.model; + +import java.net.http.HttpResponse; + +public interface ConektaModel { + + public HttpResponse get(); + public HttpResponse post(); + public HttpResponse update(); + public HttpResponse find(); + public HttpResponse delete(); + +} diff --git a/src/main/java/conekta/io/model/impl/Balance.java b/src/main/java/conekta/io/model/impl/Balance.java new file mode 100644 index 0000000..b1f0e9b --- /dev/null +++ b/src/main/java/conekta/io/model/impl/Balance.java @@ -0,0 +1,4 @@ +package conekta.io.model.impl; + +public class Balance { +} diff --git a/src/main/java/conekta/io/model/impl/ConektaList.java b/src/main/java/conekta/io/model/impl/ConektaList.java new file mode 100644 index 0000000..f93ab77 --- /dev/null +++ b/src/main/java/conekta/io/model/impl/ConektaList.java @@ -0,0 +1,4 @@ +package conekta.io.model.impl; + +public class ConektaList { +} diff --git a/src/main/java/conekta/io/model/impl/Customer.java b/src/main/java/conekta/io/model/impl/Customer.java new file mode 100644 index 0000000..9861211 --- /dev/null +++ b/src/main/java/conekta/io/model/impl/Customer.java @@ -0,0 +1,50 @@ +package conekta.io.model.impl; + +import conekta.io.model.ConektaModel; +import conekta.io.submodel.PaymentSource; +import conekta.io.submodel.ShippingContact; +import lombok.Data; + +import java.net.http.HttpResponse; +import java.util.List; + +@Data +public class Customer implements ConektaModel { + + String id; + String name; + String phone; + String planId; + List paymentSources; + boolean corporate; + List shippingContacts; + Subscription subscription; + String antifraudInfo; + String accountCreatedAt; + String firstPaidAt; + + @Override + public HttpResponse get() { + return null; + } + + @Override + public HttpResponse post() { + return null; + } + + @Override + public HttpResponse update() { + return null; + } + + @Override + public HttpResponse find() { + return null; + } + + @Override + public HttpResponse delete() { + return null; + } +} diff --git a/src/main/java/conekta/io/model/impl/Log.java b/src/main/java/conekta/io/model/impl/Log.java new file mode 100644 index 0000000..343ef60 --- /dev/null +++ b/src/main/java/conekta/io/model/impl/Log.java @@ -0,0 +1,4 @@ +package conekta.io.model.impl; + +public class Log { +} diff --git a/src/main/java/conekta/io/model/impl/Order.java b/src/main/java/conekta/io/model/impl/Order.java new file mode 100644 index 0000000..9e5f146 --- /dev/null +++ b/src/main/java/conekta/io/model/impl/Order.java @@ -0,0 +1,65 @@ +package conekta.io.model.impl; + +import conekta.io.model.ConektaModel; +import conekta.io.submodel.*; +import lombok.Data; + +import java.net.http.HttpResponse; +import java.util.List; + +@Data +public class Order implements ConektaModel { + + private String id; + private String object; + private String createdAt; + private String updatedAt; + private String currency; + private List itemLines; + private List shippingLines; + private List taxLines; + private List discountLines; + private boolean livemode; + private String metadata; + private String shippingContact; + private int amount; + private int amountRefunded; + private String paymentStatus; + private String customerInfo; + private String customerId; + private String name; + private String phone; + private String email; + private boolean corporate; + private String antifraudInfo; + private int paidTransactions; + private int accountCreatedAt; + private int firstPaidAt; + private List charges; + + + @Override + public HttpResponse get() { + return null; + } + + @Override + public HttpResponse post() { + return null; + } + + @Override + public HttpResponse update() { + return null; + } + + @Override + public HttpResponse find() { + return null; + } + + @Override + public HttpResponse delete() { + return null; + } +} diff --git a/src/main/java/conekta/io/model/impl/PaymentLink.java b/src/main/java/conekta/io/model/impl/PaymentLink.java new file mode 100644 index 0000000..3f3a7f3 --- /dev/null +++ b/src/main/java/conekta/io/model/impl/PaymentLink.java @@ -0,0 +1,4 @@ +package conekta.io.model.impl; + +public class PaymentLink { +} diff --git a/src/main/java/conekta/io/model/impl/Plan.java b/src/main/java/conekta/io/model/impl/Plan.java new file mode 100644 index 0000000..d937cac --- /dev/null +++ b/src/main/java/conekta/io/model/impl/Plan.java @@ -0,0 +1,4 @@ +package conekta.io.model.impl; + +public class Plan { +} diff --git a/src/main/java/conekta/io/model/impl/Subscription.java b/src/main/java/conekta/io/model/impl/Subscription.java new file mode 100644 index 0000000..3ac85b8 --- /dev/null +++ b/src/main/java/conekta/io/model/impl/Subscription.java @@ -0,0 +1,4 @@ +package conekta.io.model.impl; + +public class Subscription { +} diff --git a/src/main/java/conekta/io/model/impl/Transaction.java b/src/main/java/conekta/io/model/impl/Transaction.java new file mode 100644 index 0000000..5f70f63 --- /dev/null +++ b/src/main/java/conekta/io/model/impl/Transaction.java @@ -0,0 +1,4 @@ +package conekta.io.model.impl; + +public class Transaction { +} diff --git a/src/main/java/conekta/io/model/impl/Transfer.java b/src/main/java/conekta/io/model/impl/Transfer.java new file mode 100644 index 0000000..8d9f3a8 --- /dev/null +++ b/src/main/java/conekta/io/model/impl/Transfer.java @@ -0,0 +1,4 @@ +package conekta.io.model.impl; + +public class Transfer { +} diff --git a/src/main/java/conekta/io/model/impl/Webhook.java b/src/main/java/conekta/io/model/impl/Webhook.java new file mode 100644 index 0000000..bafd3f0 --- /dev/null +++ b/src/main/java/conekta/io/model/impl/Webhook.java @@ -0,0 +1,4 @@ +package conekta.io.model.impl; + +public class Webhook { +} diff --git a/src/main/java/conekta/io/submodel/Charge.java b/src/main/java/conekta/io/submodel/Charge.java new file mode 100644 index 0000000..fde63b9 --- /dev/null +++ b/src/main/java/conekta/io/submodel/Charge.java @@ -0,0 +1,4 @@ +package conekta.io.submodel; + +public class Charge { +} diff --git a/src/main/java/conekta/io/submodel/Discount.java b/src/main/java/conekta/io/submodel/Discount.java new file mode 100644 index 0000000..d680aec --- /dev/null +++ b/src/main/java/conekta/io/submodel/Discount.java @@ -0,0 +1,4 @@ +package conekta.io.submodel; + +public class Discount { +} diff --git a/src/main/java/conekta/io/submodel/PaymentSource.java b/src/main/java/conekta/io/submodel/PaymentSource.java new file mode 100644 index 0000000..b1cbcea --- /dev/null +++ b/src/main/java/conekta/io/submodel/PaymentSource.java @@ -0,0 +1,5 @@ +package conekta.io.submodel; + +public class PaymentSource { + String id; +} diff --git a/src/main/java/conekta/io/submodel/Product.java b/src/main/java/conekta/io/submodel/Product.java new file mode 100644 index 0000000..5050e94 --- /dev/null +++ b/src/main/java/conekta/io/submodel/Product.java @@ -0,0 +1,4 @@ +package conekta.io.submodel; + +public class Product { +} diff --git a/src/main/java/conekta/io/submodel/Shipping.java b/src/main/java/conekta/io/submodel/Shipping.java new file mode 100644 index 0000000..d705c7e --- /dev/null +++ b/src/main/java/conekta/io/submodel/Shipping.java @@ -0,0 +1,4 @@ +package conekta.io.submodel; + +public class Shipping { +} diff --git a/src/main/java/conekta/io/submodel/ShippingContact.java b/src/main/java/conekta/io/submodel/ShippingContact.java new file mode 100644 index 0000000..6bd919f --- /dev/null +++ b/src/main/java/conekta/io/submodel/ShippingContact.java @@ -0,0 +1,5 @@ +package conekta.io.submodel; + +public class ShippingContact { + String id; +} diff --git a/src/main/java/conekta/io/submodel/Tax.java b/src/main/java/conekta/io/submodel/Tax.java new file mode 100644 index 0000000..8be4880 --- /dev/null +++ b/src/main/java/conekta/io/submodel/Tax.java @@ -0,0 +1,4 @@ +package conekta.io.submodel; + +public class Tax { +} diff --git a/src/test/java/conekta/io/AppTest.java b/src/test/java/conekta/io/AppTest.java new file mode 100644 index 0000000..43d3715 --- /dev/null +++ b/src/test/java/conekta/io/AppTest.java @@ -0,0 +1,20 @@ +package conekta.io; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +/** + * Unit test for simple App. + */ +public class AppTest +{ + /** + * Rigorous Test :-) + */ + @Test + public void shouldAnswerWithTrue() + { + assertTrue( true ); + } +} diff --git a/target/classes/conekta/io/Startup.class b/target/classes/conekta/io/Startup.class new file mode 100644 index 0000000000000000000000000000000000000000..2a63fc032a5a385936fa60e526b337e7ad8ad4cd GIT binary patch literal 386 zcmZusJx{|h5Pg?V8UihC#m-hhA|pd97NkxQ3`Jd-oL~i))IrAKe=#93@B{c!h;v#A zq+-c;zW46kJAZwDd;++{IDwC&7{eGNLNrra*(-uSIb9Nh>*hfc`nl5brd=1(+=-%Q zWSBRlsF%VhS8u_J5pRCAKlP#<;wtb%RthG>@a6GxsSK?JNG&iBL;`GahjQaROH1Gn3XH9O8c+c zFC}Sb;6uOlM|FBuauN&7kinkW$K9)Q&z`+|_uv2idJSL++cr+(a~qd&#YPeHBPikO z5SPqv+{QI57}KI@TpQPM!}xw-;Y$l&*%-yw7QV5tWZ|a3@N%F6y&^DBoZl80tb`3I zFkTCkd=kIdk$F4Fk%SOrGM&0GRCVM2ufA;S zAXHqtklI_GYPwaWWfaA2EgQWqR+Q2aIMX*y!j({?b?y1j*S&UkpZR*wRGy9_hF||! z`pZ51>N*Nkv%JDsc0G(EUp@$o%F}PlwrHesFo`J(w;X(n?<}l1xQ#m&?mAdS#lk%Y z_wm5NL##Qd;*o`#gD3dG!Kc_1m`c>n$|W$HSQD`}W2J)^@=z!ft}bxy$fKW}0&^ce zb%BW^l#QKd($@kri79jZl_Y5>hLSH=<(4 zxMS^SGKpx8%Dopyo=JOweE763xzPr7IbD3z1=->1#oyw`VazkQ*`<1!fM#~ZOv1SmW;^U$xcsjQ^^gn@T0&;&!Rx7 zZ`gjg+_%@G_#wrETGO`#yi4yxHEE_BBe_dkyHWVkRLHWars*ZiWcmS7rswh0!9`54 z-kV9}Mu%*JKa5 zJq+w)(AbCeVC~~X4*SRpT-}5HCq{l>{~Mz}U3-PGH%BAF0CTv+5T;+iIN?nA5^T0+ zHi0qnK1If7$$5^pOAJw<*8;7JBxNX;Fi2Y-XXurq)r>w%(3iTj&69Ty=Slwp{cYrY p3r^J{-bK!HM9vY}j0#w0Kg-x9K6vHfJm0>@SSRKN`|pSI{{z~R{$~IH literal 0 HcmV?d00001 diff --git a/target/classes/conekta/io/config/ConektaAuthenticator$1.class b/target/classes/conekta/io/config/ConektaAuthenticator$1.class new file mode 100644 index 0000000000000000000000000000000000000000..f94490824f2bda0f48cba0bf1ad91eff4cbecb67 GIT binary patch literal 847 zcma)5U2oGc6g}>;W`sc3ZtK?ZvB9=3DTs(C9y%e72n14@kTxozJ$b3u8ZujQToC^X zUf2W@KY$;FxJlP3ph?V9a($1_J@!3ue*OOb6TlNZ^e~5(i&YOz+{$0KJ>0=v4;8Gr zSa)%cp}HfLv`-mkg0Rov#CjkYYCWmM-uUE5m;-*464L1Dgr|LOWS*acjvdL2!GEQc zFmcMWOi=Sc%7j~OHXnBxT0>#qP~j(S2BlT06~jgl z_TKZ4JW|3&my<}r+t*{0h!-+HX6v$z9_1p`)N_@jI+JSnTG){uxVZ0Q1DgzUdm^(h zb!L5BgU7J;pIv=yq3vTEZ5M%$5S_g60YgCTUa512=EWYRwzXksUrmEyiL86ZGnxD& zuv)h5uQhV(Iu*Umgi-v2>{^^sQ?7>5zBOddIce%Q!+del5`$E%jz`?=8pA)+r3u2r zm|;1Xe613*dl-j(tiz?7n2!oQ0K?r8g9_spAc{p^OQNL zqd`bs+@&lpuKz&g-5F-i;C#dEDXL!xtWe=ps8JHCUkEJ}tVJwQbm-Su#!7)SQKOij I(4|P@4|8tNivR!s literal 0 HcmV?d00001 diff --git a/target/classes/conekta/io/config/ConektaAuthenticator.class b/target/classes/conekta/io/config/ConektaAuthenticator.class new file mode 100644 index 0000000000000000000000000000000000000000..63c19d0beed7f2607681ad4bd60d2888d4228a0e GIT binary patch literal 926 zcma)4O>fgc6r6ROIB^VVO9O2QC4~s39Iy}v4j?3mgoG3dQlV0h8+S>!O>Jav;BWD9 zs00!}fFFgJwL>F^9D3P(yKmmio45P>&yQaK9;4^O!?uUpJ{)W}P(#-)J09+MxGNC6 zier@yCNj%ZCQzSdDvjlt5?C9a$WJny$aoy?n^ec+C(M5&@N<$L3DlnISes`8mHzI5 zfICQzSk)TpSnW;EMk;+LN0Xcy_b@;Met;%?fqR!L z5?GnP;hWKkiVSx6`X0ZA1K$!d@+~L#8t>Q=1g`S*h`Zoky?+kzm4Sm6SNo0Z>Jqxb zC@4T!#TriyT*LZ|pqnFs`cF8A=cs&Pp8tbuEw5=2-NyA9dM@`J?xNfV|MLt{cHE?P*g-#ZpqICqo#vG4=v+SuXj4o**;1;IjoL?2Ovc&$B>X>~@ zIn_QqnCceMD$UspmqydYs;%Mntlldyihebj8hNej@;@Xn_@2*|PUP;GQDl7q0f(Oj XJeU833oyNge#4+)yCzR`SRI5PL)tXE literal 0 HcmV?d00001 diff --git a/target/classes/conekta/io/model/impl/Balance.class b/target/classes/conekta/io/model/impl/Balance.class new file mode 100644 index 0000000000000000000000000000000000000000..8315984d72896db5382a6b0b3d83f62755792e0c GIT binary patch literal 688 zcma)&%SyvQ6o&sv(?n~u7qtrFZP$u8OBad@3*sUwsB}L~$98I(gk3gj7?52R+; zYqkB6co963nh&*3_%(%lnI&>>`|ltOwP|~rYQXP$BNRw>jB@$t z9qf%B7MA8BkYJhK-b{cBR;Z$pu}aav$CM3hu~!opNN<6(e#x~0WIdOx79g9sWUTmpOtQf7vo zL27epRH}ev=C)K{P6};B!2w3-VsFH(J~&&bYC?z?wytvZp_{DkZSb~} z-!g%ZfH1tDLFhNj!pL$X=Gji=4o~p-l%|NAQ`TGn30Z Nzyo4dgbvd~at0rRKxhB} literal 0 HcmV?d00001 diff --git a/target/classes/conekta/io/model/impl/List.class b/target/classes/conekta/io/model/impl/List.class new file mode 100644 index 0000000000000000000000000000000000000000..02877e4b59990f1d2115989ad64c8bb828268907 GIT binary patch literal 281 zcmZ{eKTiTd5XIjd_Xo~Xh^3*SQwq1V(9oDrU7*m=?;RT**t<2y;`g#LvET#vp$xOc zmYL*b-Y+vR^ZWO60PuiOjvg*ETxA#%(kE`&&j`KSyA>gRc56czmfV`fzNt+2sw*qx zx^%U+E8TJM|1kFNyd#Xu+O=luwPL3l39yQr535Sv`A0(j;`Uu_<{WYc0p4%)r!Ej9 zA>5q5C5*zNvbud!%W7k4j|n1qKNLwzf@msEojj0Czd>IDB4nbeV8}sVv^dQP2FS$` IE<_^~M^$w@IsgCw literal 0 HcmV?d00001 diff --git a/target/classes/conekta/io/model/impl/Log.class b/target/classes/conekta/io/model/impl/Log.class new file mode 100644 index 0000000000000000000000000000000000000000..23917c7ba72779b1ecbd77ea1aadf26f55ca9bfe GIT binary patch literal 278 zcmZ{ey>7xl5QJy_3&sf+9ipO3D7ca$5ly62RwzL9XLBM)&OT)9yjQA7DR=-LDq?NX zvMY^tKJAY7^8a@Rus{;Q#Y2e45JN)ns!Lrj3GUPLmf*eFogxfVU8;|!$W*nFnPD7xl5QJxqe-dMYl{QL|4k)-XMG#FSDk~Hq`m;H~!PysGOx}wMiGl~_qEHKlBa6P1{AY?4reu;A*Hsi~GzN+Gr*z(%Sk@ibWiiIjY`Uv<>%^|)FVvX5}lLw-w9carzfP^*X7+knv Q%}#TKTcqp=cdP-je~7xl5QJxqf50&@qC_-wNs3%ak%%S|l?6y3`m;GDN6tRvn7kJiQi?nP4~5u6 zwCqWvoliTXJDvaj0gTa$(Ly)EV}z6tzUxXi6GH3hc}?&?>_!pNOjl~QFLPC|WNw)B zGh0ZrmbG^N2L0ws{}6^*VJr3BNTIDLxxffr?u=L%S-lbBrQO$snrhe6aqx93e`Nw6 z0by`IOX#^n!HG{X&$p^*FoMV5cSHQRfi+|&t{wG@8J?X}Y zb5aMR-9mRf=$)Cy7v2!gY7@MDjaqR~tpqs5?b@k%-)v0B>&U_15XyPzJ7Z@&;tX0mnfi{ve_O3bv#G(I8Qspdd=`TUOw(w~HIy!F;7pjCLFak2KSuUNHo0$cq9FbH;aM8nr)I8E(rB~+zi&;$QU>KvpZYy zD>ukd5a$0Tsdv0Lp2MTL>sHPt%#rC&W0AH7DVEC2mIKAx9fYKmQSxG^Ze(fx8XW zw9H7K_Pv>X()|4HzX9B%NHId5;5@;Y5I<_G+bLmmeX}HlPj00M<5F8S>zYdWg{%xa z7p1GESxT>aeK5oJU2h1JvUXN|v{Gm%8V)c*H=jlG#JpOoy2TX&KBX_><`ibkN(>r^Zg-$98vzn#%r^ML2{Rks N5l)e^BAhV;WPb_*KtTWi literal 0 HcmV?d00001 diff --git a/target/classes/conekta/io/model/impl/Webhook.class b/target/classes/conekta/io/model/impl/Webhook.class new file mode 100644 index 0000000000000000000000000000000000000000..2c98f83d576236de05927435766522391cac9c0c GIT binary patch literal 290 zcmaKny>7xl5QJy_8ypiO`Y56!DRN~B5KSa13knd_XXk_u&c4VP-irz;MIImz6|qLt z>`J4ZPrD=S-~Z1qfDiN{xafv>3Xu?kv95G8A-KcW6~X(oUy6{Vx>B=4nW=gyGsC2x z+FY8Itaa;e&}$04C%mM&t<?XEDg+K73!Re6H}9R8y%;^q+6fStH{z<)b~P7EA`tN~;2!2@f2oqco= Ku_HXPI*2dBZ9d!p literal 0 HcmV?d00001 From 146d4d64ddcf6cc51e8d088a4b2020e460b8163e Mon Sep 17 00:00:00 2001 From: Matias Date: Fri, 1 Jul 2022 11:50:47 -0300 Subject: [PATCH 02/24] Refactor and principal HTTPCLIENT --- src/main/java/conekta/io/Startup.java | 9 ---- .../conekta/io/client/ConektaRequestor.java | 22 +++++++-- src/main/java/conekta/io/config/Headers.java | 5 +- .../io/error/IOConektaRequestorException.java | 27 +++++++++++ .../InterruptedConektaRequestorException.java | 23 +++++++++ .../java/conekta/io/model/ConektaModel.java | 13 ----- .../java/conekta/io/model/ConektaObject.java | 15 ++++++ .../java/conekta/io/model/impl/Balance.java | 4 +- .../java/conekta/io/model/impl/Checkout.java | 6 +++ .../conekta/io/model/impl/ConektaList.java | 4 +- .../java/conekta/io/model/impl/Customer.java | 48 +------------------ src/main/java/conekta/io/model/impl/Log.java | 4 +- .../java/conekta/io/model/impl/Order.java | 36 ++------------ .../conekta/io/model/impl/PaymentLink.java | 4 -- src/main/java/conekta/io/model/impl/Plan.java | 4 +- .../conekta/io/model/impl/Subscription.java | 4 +- .../conekta/io/model/impl/Transaction.java | 4 +- .../java/conekta/io/model/impl/Transfer.java | 4 +- .../java/conekta/io/model/impl/Webhook.java | 4 +- .../conekta/io/model/submodel/Charge.java | 6 +++ .../conekta/io/model/submodel/Discount.java | 6 +++ .../io/model/submodel/PaymentSource.java | 6 +++ .../conekta/io/model/submodel/Product.java | 6 +++ .../conekta/io/model/submodel/Shipping.java | 6 +++ .../io/model/submodel/ShippingContact.java | 6 +++ .../java/conekta/io/model/submodel/Tax.java | 6 +++ src/main/java/conekta/io/submodel/Charge.java | 4 -- .../java/conekta/io/submodel/Discount.java | 4 -- .../conekta/io/submodel/PaymentSource.java | 5 -- .../java/conekta/io/submodel/Product.java | 4 -- .../java/conekta/io/submodel/Shipping.java | 4 -- .../conekta/io/submodel/ShippingContact.java | 5 -- src/main/java/conekta/io/submodel/Tax.java | 4 -- 33 files changed, 163 insertions(+), 149 deletions(-) delete mode 100644 src/main/java/conekta/io/Startup.java create mode 100644 src/main/java/conekta/io/error/IOConektaRequestorException.java create mode 100644 src/main/java/conekta/io/error/InterruptedConektaRequestorException.java delete mode 100644 src/main/java/conekta/io/model/ConektaModel.java create mode 100644 src/main/java/conekta/io/model/ConektaObject.java create mode 100644 src/main/java/conekta/io/model/impl/Checkout.java delete mode 100644 src/main/java/conekta/io/model/impl/PaymentLink.java create mode 100644 src/main/java/conekta/io/model/submodel/Charge.java create mode 100644 src/main/java/conekta/io/model/submodel/Discount.java create mode 100644 src/main/java/conekta/io/model/submodel/PaymentSource.java create mode 100644 src/main/java/conekta/io/model/submodel/Product.java create mode 100644 src/main/java/conekta/io/model/submodel/Shipping.java create mode 100644 src/main/java/conekta/io/model/submodel/ShippingContact.java create mode 100644 src/main/java/conekta/io/model/submodel/Tax.java delete mode 100644 src/main/java/conekta/io/submodel/Charge.java delete mode 100644 src/main/java/conekta/io/submodel/Discount.java delete mode 100644 src/main/java/conekta/io/submodel/PaymentSource.java delete mode 100644 src/main/java/conekta/io/submodel/Product.java delete mode 100644 src/main/java/conekta/io/submodel/Shipping.java delete mode 100644 src/main/java/conekta/io/submodel/ShippingContact.java delete mode 100644 src/main/java/conekta/io/submodel/Tax.java diff --git a/src/main/java/conekta/io/Startup.java b/src/main/java/conekta/io/Startup.java deleted file mode 100644 index 89293f4..0000000 --- a/src/main/java/conekta/io/Startup.java +++ /dev/null @@ -1,9 +0,0 @@ -package conekta.io; - -public class Startup { - - public static void main(String[] args) { - - } - -} diff --git a/src/main/java/conekta/io/client/ConektaRequestor.java b/src/main/java/conekta/io/client/ConektaRequestor.java index 58b724f..3478466 100644 --- a/src/main/java/conekta/io/client/ConektaRequestor.java +++ b/src/main/java/conekta/io/client/ConektaRequestor.java @@ -1,8 +1,13 @@ package conekta.io.client; import conekta.io.config.ConektaAuthenticator; +import conekta.io.config.Headers; +import conekta.io.error.IOConektaRequestorException; +import conekta.io.error.InterruptedConektaRequestorException; +import conekta.io.model.ConektaObject; import java.io.IOException; +import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; @@ -10,7 +15,7 @@ public class ConektaRequestor { - public HttpResponse send(HttpRequest request){ + private HttpResponse send(HttpRequest request){ try { return HttpClient.newBuilder() .authenticator(ConektaAuthenticator.getBasicAuthenticator()) @@ -18,10 +23,21 @@ public HttpResponse send(HttpRequest request){ .build() .send(request, HttpResponse.BodyHandlers.ofString()); } catch (IOException e) { - throw new RuntimeException(e); + throw new IOConektaRequestorException(e); } catch (InterruptedException e) { - throw new RuntimeException(e); + throw new InterruptedConektaRequestorException(e); } } + public HttpResponse doRequest(ConektaObject conektaObject, Headers headers, String url , String method){ + HttpRequest request = HttpRequest.newBuilder() + .method(method, HttpRequest.BodyPublishers.ofString(conektaObject.parseToString())) + .uri(URI.create(url)) + .headers(headers.getListed()) + .build(); + + return send(request); + } + + } diff --git a/src/main/java/conekta/io/config/Headers.java b/src/main/java/conekta/io/config/Headers.java index 03f2d54..cc697d1 100644 --- a/src/main/java/conekta/io/config/Headers.java +++ b/src/main/java/conekta/io/config/Headers.java @@ -1,9 +1,8 @@ package conekta.io.config; -import java.net.http.HttpHeaders; public class Headers { - public HttpHeaders getHeaders() { - return null; + public String getListed() { + return ""; } } diff --git a/src/main/java/conekta/io/error/IOConektaRequestorException.java b/src/main/java/conekta/io/error/IOConektaRequestorException.java new file mode 100644 index 0000000..ab468dc --- /dev/null +++ b/src/main/java/conekta/io/error/IOConektaRequestorException.java @@ -0,0 +1,27 @@ +package conekta.io.error; + +import java.io.IOException; + +public class IOConektaRequestorException extends RuntimeException { + public IOConektaRequestorException() { + } + + public IOConektaRequestorException(String message) { + super(message); + } + + public IOConektaRequestorException(String message, Throwable cause) { + super(message, cause); + } + + public IOConektaRequestorException(Throwable cause) { + super(cause); + } + + public IOConektaRequestorException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } + + public IOConektaRequestorException(IOException e) { + } +} diff --git a/src/main/java/conekta/io/error/InterruptedConektaRequestorException.java b/src/main/java/conekta/io/error/InterruptedConektaRequestorException.java new file mode 100644 index 0000000..af14b59 --- /dev/null +++ b/src/main/java/conekta/io/error/InterruptedConektaRequestorException.java @@ -0,0 +1,23 @@ +package conekta.io.error; + +public class InterruptedConektaRequestorException extends RuntimeException { + + public InterruptedConektaRequestorException() { + } + + public InterruptedConektaRequestorException(String message) { + super(message); + } + + public InterruptedConektaRequestorException(String message, Throwable cause) { + super(message, cause); + } + + public InterruptedConektaRequestorException(Throwable cause) { + super(cause); + } + + public InterruptedConektaRequestorException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } +} diff --git a/src/main/java/conekta/io/model/ConektaModel.java b/src/main/java/conekta/io/model/ConektaModel.java deleted file mode 100644 index 13f3ffd..0000000 --- a/src/main/java/conekta/io/model/ConektaModel.java +++ /dev/null @@ -1,13 +0,0 @@ -package conekta.io.model; - -import java.net.http.HttpResponse; - -public interface ConektaModel { - - public HttpResponse get(); - public HttpResponse post(); - public HttpResponse update(); - public HttpResponse find(); - public HttpResponse delete(); - -} diff --git a/src/main/java/conekta/io/model/ConektaObject.java b/src/main/java/conekta/io/model/ConektaObject.java new file mode 100644 index 0000000..a677156 --- /dev/null +++ b/src/main/java/conekta/io/model/ConektaObject.java @@ -0,0 +1,15 @@ +package conekta.io.model; + +import lombok.Data; + +@Data +public abstract class ConektaObject { + +private String id; +private String object; + +public String parseToString(){ + return this.toString(); +} + +} diff --git a/src/main/java/conekta/io/model/impl/Balance.java b/src/main/java/conekta/io/model/impl/Balance.java index b1f0e9b..5031fed 100644 --- a/src/main/java/conekta/io/model/impl/Balance.java +++ b/src/main/java/conekta/io/model/impl/Balance.java @@ -1,4 +1,6 @@ package conekta.io.model.impl; -public class Balance { +import conekta.io.model.ConektaObject; + +public class Balance extends ConektaObject { } diff --git a/src/main/java/conekta/io/model/impl/Checkout.java b/src/main/java/conekta/io/model/impl/Checkout.java new file mode 100644 index 0000000..959ff15 --- /dev/null +++ b/src/main/java/conekta/io/model/impl/Checkout.java @@ -0,0 +1,6 @@ +package conekta.io.model.impl; + +import conekta.io.model.ConektaObject; + +public class Checkout extends ConektaObject { +} diff --git a/src/main/java/conekta/io/model/impl/ConektaList.java b/src/main/java/conekta/io/model/impl/ConektaList.java index f93ab77..c00036b 100644 --- a/src/main/java/conekta/io/model/impl/ConektaList.java +++ b/src/main/java/conekta/io/model/impl/ConektaList.java @@ -1,4 +1,6 @@ package conekta.io.model.impl; -public class ConektaList { +import conekta.io.model.ConektaObject; + +public class ConektaList extends ConektaObject { } diff --git a/src/main/java/conekta/io/model/impl/Customer.java b/src/main/java/conekta/io/model/impl/Customer.java index 9861211..5a3f5ae 100644 --- a/src/main/java/conekta/io/model/impl/Customer.java +++ b/src/main/java/conekta/io/model/impl/Customer.java @@ -1,50 +1,6 @@ package conekta.io.model.impl; -import conekta.io.model.ConektaModel; -import conekta.io.submodel.PaymentSource; -import conekta.io.submodel.ShippingContact; -import lombok.Data; +import conekta.io.model.ConektaObject; -import java.net.http.HttpResponse; -import java.util.List; - -@Data -public class Customer implements ConektaModel { - - String id; - String name; - String phone; - String planId; - List paymentSources; - boolean corporate; - List shippingContacts; - Subscription subscription; - String antifraudInfo; - String accountCreatedAt; - String firstPaidAt; - - @Override - public HttpResponse get() { - return null; - } - - @Override - public HttpResponse post() { - return null; - } - - @Override - public HttpResponse update() { - return null; - } - - @Override - public HttpResponse find() { - return null; - } - - @Override - public HttpResponse delete() { - return null; - } +public class Customer extends ConektaObject { } diff --git a/src/main/java/conekta/io/model/impl/Log.java b/src/main/java/conekta/io/model/impl/Log.java index 343ef60..95fc3db 100644 --- a/src/main/java/conekta/io/model/impl/Log.java +++ b/src/main/java/conekta/io/model/impl/Log.java @@ -1,4 +1,6 @@ package conekta.io.model.impl; -public class Log { +import conekta.io.model.ConektaObject; + +public class Log extends ConektaObject { } diff --git a/src/main/java/conekta/io/model/impl/Order.java b/src/main/java/conekta/io/model/impl/Order.java index 9e5f146..b56625e 100644 --- a/src/main/java/conekta/io/model/impl/Order.java +++ b/src/main/java/conekta/io/model/impl/Order.java @@ -1,17 +1,13 @@ package conekta.io.model.impl; -import conekta.io.model.ConektaModel; -import conekta.io.submodel.*; +import conekta.io.model.ConektaObject; +import conekta.io.model.submodel.*; import lombok.Data; -import java.net.http.HttpResponse; import java.util.List; @Data -public class Order implements ConektaModel { - - private String id; - private String object; +public class Order extends ConektaObject { private String createdAt; private String updatedAt; private String currency; @@ -36,30 +32,4 @@ public class Order implements ConektaModel { private int accountCreatedAt; private int firstPaidAt; private List charges; - - - @Override - public HttpResponse get() { - return null; - } - - @Override - public HttpResponse post() { - return null; - } - - @Override - public HttpResponse update() { - return null; - } - - @Override - public HttpResponse find() { - return null; - } - - @Override - public HttpResponse delete() { - return null; - } } diff --git a/src/main/java/conekta/io/model/impl/PaymentLink.java b/src/main/java/conekta/io/model/impl/PaymentLink.java deleted file mode 100644 index 3f3a7f3..0000000 --- a/src/main/java/conekta/io/model/impl/PaymentLink.java +++ /dev/null @@ -1,4 +0,0 @@ -package conekta.io.model.impl; - -public class PaymentLink { -} diff --git a/src/main/java/conekta/io/model/impl/Plan.java b/src/main/java/conekta/io/model/impl/Plan.java index d937cac..5eff336 100644 --- a/src/main/java/conekta/io/model/impl/Plan.java +++ b/src/main/java/conekta/io/model/impl/Plan.java @@ -1,4 +1,6 @@ package conekta.io.model.impl; -public class Plan { +import conekta.io.model.ConektaObject; + +public class Plan extends ConektaObject { } diff --git a/src/main/java/conekta/io/model/impl/Subscription.java b/src/main/java/conekta/io/model/impl/Subscription.java index 3ac85b8..799f010 100644 --- a/src/main/java/conekta/io/model/impl/Subscription.java +++ b/src/main/java/conekta/io/model/impl/Subscription.java @@ -1,4 +1,6 @@ package conekta.io.model.impl; -public class Subscription { +import conekta.io.model.ConektaObject; + +public class Subscription extends ConektaObject { } diff --git a/src/main/java/conekta/io/model/impl/Transaction.java b/src/main/java/conekta/io/model/impl/Transaction.java index 5f70f63..1416ebd 100644 --- a/src/main/java/conekta/io/model/impl/Transaction.java +++ b/src/main/java/conekta/io/model/impl/Transaction.java @@ -1,4 +1,6 @@ package conekta.io.model.impl; -public class Transaction { +import conekta.io.model.ConektaObject; + +public class Transaction extends ConektaObject { } diff --git a/src/main/java/conekta/io/model/impl/Transfer.java b/src/main/java/conekta/io/model/impl/Transfer.java index 8d9f3a8..e918d31 100644 --- a/src/main/java/conekta/io/model/impl/Transfer.java +++ b/src/main/java/conekta/io/model/impl/Transfer.java @@ -1,4 +1,6 @@ package conekta.io.model.impl; -public class Transfer { +import conekta.io.model.ConektaObject; + +public class Transfer extends ConektaObject { } diff --git a/src/main/java/conekta/io/model/impl/Webhook.java b/src/main/java/conekta/io/model/impl/Webhook.java index bafd3f0..56bfc52 100644 --- a/src/main/java/conekta/io/model/impl/Webhook.java +++ b/src/main/java/conekta/io/model/impl/Webhook.java @@ -1,4 +1,6 @@ package conekta.io.model.impl; -public class Webhook { +import conekta.io.model.ConektaObject; + +public class Webhook extends ConektaObject { } diff --git a/src/main/java/conekta/io/model/submodel/Charge.java b/src/main/java/conekta/io/model/submodel/Charge.java new file mode 100644 index 0000000..c60de43 --- /dev/null +++ b/src/main/java/conekta/io/model/submodel/Charge.java @@ -0,0 +1,6 @@ +package conekta.io.model.submodel; + +import conekta.io.model.ConektaObject; + +public class Charge extends ConektaObject { +} diff --git a/src/main/java/conekta/io/model/submodel/Discount.java b/src/main/java/conekta/io/model/submodel/Discount.java new file mode 100644 index 0000000..85110b6 --- /dev/null +++ b/src/main/java/conekta/io/model/submodel/Discount.java @@ -0,0 +1,6 @@ +package conekta.io.model.submodel; + +import conekta.io.model.ConektaObject; + +public class Discount extends ConektaObject { +} diff --git a/src/main/java/conekta/io/model/submodel/PaymentSource.java b/src/main/java/conekta/io/model/submodel/PaymentSource.java new file mode 100644 index 0000000..3b21570 --- /dev/null +++ b/src/main/java/conekta/io/model/submodel/PaymentSource.java @@ -0,0 +1,6 @@ +package conekta.io.model.submodel; + +import conekta.io.model.ConektaObject; + +public class PaymentSource extends ConektaObject { +} diff --git a/src/main/java/conekta/io/model/submodel/Product.java b/src/main/java/conekta/io/model/submodel/Product.java new file mode 100644 index 0000000..73b829b --- /dev/null +++ b/src/main/java/conekta/io/model/submodel/Product.java @@ -0,0 +1,6 @@ +package conekta.io.model.submodel; + +import conekta.io.model.ConektaObject; + +public class Product extends ConektaObject { +} diff --git a/src/main/java/conekta/io/model/submodel/Shipping.java b/src/main/java/conekta/io/model/submodel/Shipping.java new file mode 100644 index 0000000..af1477c --- /dev/null +++ b/src/main/java/conekta/io/model/submodel/Shipping.java @@ -0,0 +1,6 @@ +package conekta.io.model.submodel; + +import conekta.io.model.ConektaObject; + +public class Shipping extends ConektaObject { +} diff --git a/src/main/java/conekta/io/model/submodel/ShippingContact.java b/src/main/java/conekta/io/model/submodel/ShippingContact.java new file mode 100644 index 0000000..4c93e87 --- /dev/null +++ b/src/main/java/conekta/io/model/submodel/ShippingContact.java @@ -0,0 +1,6 @@ +package conekta.io.model.submodel; + +import conekta.io.model.ConektaObject; + +public class ShippingContact extends ConektaObject { +} diff --git a/src/main/java/conekta/io/model/submodel/Tax.java b/src/main/java/conekta/io/model/submodel/Tax.java new file mode 100644 index 0000000..ee18ace --- /dev/null +++ b/src/main/java/conekta/io/model/submodel/Tax.java @@ -0,0 +1,6 @@ +package conekta.io.model.submodel; + +import conekta.io.model.ConektaObject; + +public class Tax extends ConektaObject { +} diff --git a/src/main/java/conekta/io/submodel/Charge.java b/src/main/java/conekta/io/submodel/Charge.java deleted file mode 100644 index fde63b9..0000000 --- a/src/main/java/conekta/io/submodel/Charge.java +++ /dev/null @@ -1,4 +0,0 @@ -package conekta.io.submodel; - -public class Charge { -} diff --git a/src/main/java/conekta/io/submodel/Discount.java b/src/main/java/conekta/io/submodel/Discount.java deleted file mode 100644 index d680aec..0000000 --- a/src/main/java/conekta/io/submodel/Discount.java +++ /dev/null @@ -1,4 +0,0 @@ -package conekta.io.submodel; - -public class Discount { -} diff --git a/src/main/java/conekta/io/submodel/PaymentSource.java b/src/main/java/conekta/io/submodel/PaymentSource.java deleted file mode 100644 index b1cbcea..0000000 --- a/src/main/java/conekta/io/submodel/PaymentSource.java +++ /dev/null @@ -1,5 +0,0 @@ -package conekta.io.submodel; - -public class PaymentSource { - String id; -} diff --git a/src/main/java/conekta/io/submodel/Product.java b/src/main/java/conekta/io/submodel/Product.java deleted file mode 100644 index 5050e94..0000000 --- a/src/main/java/conekta/io/submodel/Product.java +++ /dev/null @@ -1,4 +0,0 @@ -package conekta.io.submodel; - -public class Product { -} diff --git a/src/main/java/conekta/io/submodel/Shipping.java b/src/main/java/conekta/io/submodel/Shipping.java deleted file mode 100644 index d705c7e..0000000 --- a/src/main/java/conekta/io/submodel/Shipping.java +++ /dev/null @@ -1,4 +0,0 @@ -package conekta.io.submodel; - -public class Shipping { -} diff --git a/src/main/java/conekta/io/submodel/ShippingContact.java b/src/main/java/conekta/io/submodel/ShippingContact.java deleted file mode 100644 index 6bd919f..0000000 --- a/src/main/java/conekta/io/submodel/ShippingContact.java +++ /dev/null @@ -1,5 +0,0 @@ -package conekta.io.submodel; - -public class ShippingContact { - String id; -} diff --git a/src/main/java/conekta/io/submodel/Tax.java b/src/main/java/conekta/io/submodel/Tax.java deleted file mode 100644 index 8be4880..0000000 --- a/src/main/java/conekta/io/submodel/Tax.java +++ /dev/null @@ -1,4 +0,0 @@ -package conekta.io.submodel; - -public class Tax { -} From eb6f24b0f1e252c64eb9103af408eac05ae92296 Mon Sep 17 00:00:00 2001 From: Matias Date: Fri, 1 Jul 2022 11:56:17 -0300 Subject: [PATCH 03/24] gitIgnore --- .gitignore | 162 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b9b3685 --- /dev/null +++ b/.gitignore @@ -0,0 +1,162 @@ +# Created by https://www.toptal.com/developers/gitignore/api/intellij,java,maven +# Edit at https://www.toptal.com/developers/gitignore?templates=intellij,java,maven + +### Intellij ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +# https://plugins.jetbrains.com/plugin/7973-sonarlint +.idea/**/sonarlint/ + +# SonarQube Plugin +# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin +.idea/**/sonarIssues.xml + +# Markdown Navigator plugin +# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced +.idea/**/markdown-navigator.xml +.idea/**/markdown-navigator-enh.xml +.idea/**/markdown-navigator/ + +# Cache file creation bug +# See https://youtrack.jetbrains.com/issue/JBR-2257 +.idea/$CACHE_FILE$ + +# CodeStream plugin +# https://plugins.jetbrains.com/plugin/12206-codestream +.idea/codestream.xml + +# Azure Toolkit for IntelliJ plugin +# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij +.idea/**/azureSettings.xml + +### Java ### +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +replay_pid* + +### Maven ### +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +# https://github.com/takari/maven-wrapper#usage-without-binary-jar +.mvn/wrapper/maven-wrapper.jar + +# Eclipse m2e generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# End of https://www.toptal.com/developers/gitignore/api/intellij,java,maven \ No newline at end of file From 37349d08e23d307e2cfc73f20047a71d7200a906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Rosemberg?= Date: Fri, 1 Jul 2022 12:08:08 -0300 Subject: [PATCH 04/24] Main readme --- README.md | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 450f51d..62615c7 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,26 @@ -# conekta-empty-template -Conekta empty repository - Used as template +# ct-conekta-java + +## Upgraded Conekta JAVA Library + +El objetivo principal de esta libreria es conectarse con el cliente principal de Conekta y facilitar su uso desde Java, evitando la manipulacion de JSON innecesarios, la documentacion del mismo se encuentra en: + +https://developers.conekta.com/reference/autenticaci%C3%B3n + +## Features: + +### JAVA 11 + +Se upgradeo la libreria a JAVA 11 debido a que la anterior estaba en Java 7, permitiendo mas optimalidad en los clientes HTTP y facilidad de escritura de la misma. + +### Nuevo cliente HttpClient + +La documentacion del mismo se encuentra en: +https://openjdk.org/groups/net/httpclient/intro.html + +### JacksonMapper para el manejo de JSON de manera optima. + +https://github.com/FasterXML/jackson + +### Nueva estructura mas ordenada. + +Basada en carpetas y teniendo en cuenta las estructuras que generalmente se usan en los proyectos actuales de microservicios. From 8877bc4c70a6d754c06652e67fbeffbbfa34c6b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Rosemberg?= Date: Fri, 1 Jul 2022 12:11:35 -0300 Subject: [PATCH 05/24] Delete target/classes/conekta/io directory --- target/classes/conekta/io/Startup.class | Bin 386 -> 0 bytes .../conekta/io/client/ConektaRequestor.class | Bin 1859 -> 0 bytes .../io/config/ConektaAuthenticator$1.class | Bin 847 -> 0 bytes .../conekta/io/config/ConektaAuthenticator.class | Bin 926 -> 0 bytes target/classes/conekta/io/config/Headers.class | Bin 282 -> 0 bytes .../classes/conekta/io/model/ConektaModel.class | Bin 233 -> 0 bytes .../classes/conekta/io/model/impl/Balance.class | Bin 688 -> 0 bytes .../classes/conekta/io/model/impl/Customer.class | Bin 293 -> 0 bytes target/classes/conekta/io/model/impl/List.class | Bin 281 -> 0 bytes target/classes/conekta/io/model/impl/Log.class | Bin 278 -> 0 bytes target/classes/conekta/io/model/impl/Order.class | Bin 284 -> 0 bytes .../conekta/io/model/impl/PaymentLink.class | Bin 302 -> 0 bytes target/classes/conekta/io/model/impl/Plan.class | Bin 281 -> 0 bytes .../conekta/io/model/impl/Subscription.class | Bin 305 -> 0 bytes .../conekta/io/model/impl/Transaction.class | Bin 302 -> 0 bytes .../classes/conekta/io/model/impl/Transfer.class | Bin 293 -> 0 bytes .../classes/conekta/io/model/impl/Webhook.class | Bin 290 -> 0 bytes 17 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 target/classes/conekta/io/Startup.class delete mode 100644 target/classes/conekta/io/client/ConektaRequestor.class delete mode 100644 target/classes/conekta/io/config/ConektaAuthenticator$1.class delete mode 100644 target/classes/conekta/io/config/ConektaAuthenticator.class delete mode 100644 target/classes/conekta/io/config/Headers.class delete mode 100644 target/classes/conekta/io/model/ConektaModel.class delete mode 100644 target/classes/conekta/io/model/impl/Balance.class delete mode 100644 target/classes/conekta/io/model/impl/Customer.class delete mode 100644 target/classes/conekta/io/model/impl/List.class delete mode 100644 target/classes/conekta/io/model/impl/Log.class delete mode 100644 target/classes/conekta/io/model/impl/Order.class delete mode 100644 target/classes/conekta/io/model/impl/PaymentLink.class delete mode 100644 target/classes/conekta/io/model/impl/Plan.class delete mode 100644 target/classes/conekta/io/model/impl/Subscription.class delete mode 100644 target/classes/conekta/io/model/impl/Transaction.class delete mode 100644 target/classes/conekta/io/model/impl/Transfer.class delete mode 100644 target/classes/conekta/io/model/impl/Webhook.class diff --git a/target/classes/conekta/io/Startup.class b/target/classes/conekta/io/Startup.class deleted file mode 100644 index 2a63fc032a5a385936fa60e526b337e7ad8ad4cd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 386 zcmZusJx{|h5Pg?V8UihC#m-hhA|pd97NkxQ3`Jd-oL~i))IrAKe=#93@B{c!h;v#A zq+-c;zW46kJAZwDd;++{IDwC&7{eGNLNrra*(-uSIb9Nh>*hfc`nl5brd=1(+=-%Q zWSBRlsF%VhS8u_J5pRCAKlP#<;wtb%RthG>@a6GxsSK?JNG&iBL;`GahjQaROH1Gn3XH9O8c+c zFC}Sb;6uOlM|FBuauN&7kinkW$K9)Q&z`+|_uv2idJSL++cr+(a~qd&#YPeHBPikO z5SPqv+{QI57}KI@TpQPM!}xw-;Y$l&*%-yw7QV5tWZ|a3@N%F6y&^DBoZl80tb`3I zFkTCkd=kIdk$F4Fk%SOrGM&0GRCVM2ufA;S zAXHqtklI_GYPwaWWfaA2EgQWqR+Q2aIMX*y!j({?b?y1j*S&UkpZR*wRGy9_hF||! z`pZ51>N*Nkv%JDsc0G(EUp@$o%F}PlwrHesFo`J(w;X(n?<}l1xQ#m&?mAdS#lk%Y z_wm5NL##Qd;*o`#gD3dG!Kc_1m`c>n$|W$HSQD`}W2J)^@=z!ft}bxy$fKW}0&^ce zb%BW^l#QKd($@kri79jZl_Y5>hLSH=<(4 zxMS^SGKpx8%Dopyo=JOweE763xzPr7IbD3z1=->1#oyw`VazkQ*`<1!fM#~ZOv1SmW;^U$xcsjQ^^gn@T0&;&!Rx7 zZ`gjg+_%@G_#wrETGO`#yi4yxHEE_BBe_dkyHWVkRLHWars*ZiWcmS7rswh0!9`54 z-kV9}Mu%*JKa5 zJq+w)(AbCeVC~~X4*SRpT-}5HCq{l>{~Mz}U3-PGH%BAF0CTv+5T;+iIN?nA5^T0+ zHi0qnK1If7$$5^pOAJw<*8;7JBxNX;Fi2Y-XXurq)r>w%(3iTj&69Ty=Slwp{cYrY p3r^J{-bK!HM9vY}j0#w0Kg-x9K6vHfJm0>@SSRKN`|pSI{{z~R{$~IH diff --git a/target/classes/conekta/io/config/ConektaAuthenticator$1.class b/target/classes/conekta/io/config/ConektaAuthenticator$1.class deleted file mode 100644 index f94490824f2bda0f48cba0bf1ad91eff4cbecb67..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 847 zcma)5U2oGc6g}>;W`sc3ZtK?ZvB9=3DTs(C9y%e72n14@kTxozJ$b3u8ZujQToC^X zUf2W@KY$;FxJlP3ph?V9a($1_J@!3ue*OOb6TlNZ^e~5(i&YOz+{$0KJ>0=v4;8Gr zSa)%cp}HfLv`-mkg0Rov#CjkYYCWmM-uUE5m;-*464L1Dgr|LOWS*acjvdL2!GEQc zFmcMWOi=Sc%7j~OHXnBxT0>#qP~j(S2BlT06~jgl z_TKZ4JW|3&my<}r+t*{0h!-+HX6v$z9_1p`)N_@jI+JSnTG){uxVZ0Q1DgzUdm^(h zb!L5BgU7J;pIv=yq3vTEZ5M%$5S_g60YgCTUa512=EWYRwzXksUrmEyiL86ZGnxD& zuv)h5uQhV(Iu*Umgi-v2>{^^sQ?7>5zBOddIce%Q!+del5`$E%jz`?=8pA)+r3u2r zm|;1Xe613*dl-j(tiz?7n2!oQ0K?r8g9_spAc{p^OQNL zqd`bs+@&lpuKz&g-5F-i;C#dEDXL!xtWe=ps8JHCUkEJ}tVJwQbm-Su#!7)SQKOij I(4|P@4|8tNivR!s diff --git a/target/classes/conekta/io/config/ConektaAuthenticator.class b/target/classes/conekta/io/config/ConektaAuthenticator.class deleted file mode 100644 index 63c19d0beed7f2607681ad4bd60d2888d4228a0e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 926 zcma)4O>fgc6r6ROIB^VVO9O2QC4~s39Iy}v4j?3mgoG3dQlV0h8+S>!O>Jav;BWD9 zs00!}fFFgJwL>F^9D3P(yKmmio45P>&yQaK9;4^O!?uUpJ{)W}P(#-)J09+MxGNC6 zier@yCNj%ZCQzSdDvjlt5?C9a$WJny$aoy?n^ec+C(M5&@N<$L3DlnISes`8mHzI5 zfICQzSk)TpSnW;EMk;+LN0Xcy_b@;Met;%?fqR!L z5?GnP;hWKkiVSx6`X0ZA1K$!d@+~L#8t>Q=1g`S*h`Zoky?+kzm4Sm6SNo0Z>Jqxb zC@4T!#TriyT*LZ|pqnFs`cF8A=cs&Pp8tbuEw5=2-NyA9dM@`J?xNfV|MLt{cHE?P*g-#ZpqICqo#vG4=v+SuXj4o**;1;IjoL?2Ovc&$B>X>~@ zIn_QqnCceMD$UspmqydYs;%Mntlldyihebj8hNej@;@Xn_@2*|PUP;GQDl7q0f(Oj XJeU833oyNge#4+)yCzR`SRI5PL)tXE diff --git a/target/classes/conekta/io/model/impl/Balance.class b/target/classes/conekta/io/model/impl/Balance.class deleted file mode 100644 index 8315984d72896db5382a6b0b3d83f62755792e0c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 688 zcma)&%SyvQ6o&sv(?n~u7qtrFZP$u8OBad@3*sUwsB}L~$98I(gk3gj7?52R+; zYqkB6co963nh&*3_%(%lnI&>>`|ltOwP|~rYQXP$BNRw>jB@$t z9qf%B7MA8BkYJhK-b{cBR;Z$pu}aav$CM3hu~!opNN<6(e#x~0WIdOx79g9sWUTmpOtQf7vo zL27epRH}ev=C)K{P6};B!2w3-VsFH(J~&&bYC?z?wytvZp_{DkZSb~} z-!g%ZfH1tDLFhNj!pL$X=Gji=4o~p-l%|NAQ`TGn30Z Nzyo4dgbvd~at0rRKxhB} diff --git a/target/classes/conekta/io/model/impl/List.class b/target/classes/conekta/io/model/impl/List.class deleted file mode 100644 index 02877e4b59990f1d2115989ad64c8bb828268907..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 281 zcmZ{eKTiTd5XIjd_Xo~Xh^3*SQwq1V(9oDrU7*m=?;RT**t<2y;`g#LvET#vp$xOc zmYL*b-Y+vR^ZWO60PuiOjvg*ETxA#%(kE`&&j`KSyA>gRc56czmfV`fzNt+2sw*qx zx^%U+E8TJM|1kFNyd#Xu+O=luwPL3l39yQr535Sv`A0(j;`Uu_<{WYc0p4%)r!Ej9 zA>5q5C5*zNvbud!%W7k4j|n1qKNLwzf@msEojj0Czd>IDB4nbeV8}sVv^dQP2FS$` IE<_^~M^$w@IsgCw diff --git a/target/classes/conekta/io/model/impl/Log.class b/target/classes/conekta/io/model/impl/Log.class deleted file mode 100644 index 23917c7ba72779b1ecbd77ea1aadf26f55ca9bfe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 278 zcmZ{ey>7xl5QJy_3&sf+9ipO3D7ca$5ly62RwzL9XLBM)&OT)9yjQA7DR=-LDq?NX zvMY^tKJAY7^8a@Rus{;Q#Y2e45JN)ns!Lrj3GUPLmf*eFogxfVU8;|!$W*nFnPD7xl5QJxqe-dMYl{QL|4k)-XMG#FSDk~Hq`m;H~!PysGOx}wMiGl~_qEHKlBa6P1{AY?4reu;A*Hsi~GzN+Gr*z(%Sk@ibWiiIjY`Uv<>%^|)FVvX5}lLw-w9carzfP^*X7+knv Q%}#TKTcqp=cdP-je~7xl5QJxqf50&@qC_-wNs3%ak%%S|l?6y3`m;GDN6tRvn7kJiQi?nP4~5u6 zwCqWvoliTXJDvaj0gTa$(Ly)EV}z6tzUxXi6GH3hc}?&?>_!pNOjl~QFLPC|WNw)B zGh0ZrmbG^N2L0ws{}6^*VJr3BNTIDLxxffr?u=L%S-lbBrQO$snrhe6aqx93e`Nw6 z0by`IOX#^n!HG{X&$p^*FoMV5cSHQRfi+|&t{wG@8J?X}Y zb5aMR-9mRf=$)Cy7v2!gY7@MDjaqR~tpqs5?b@k%-)v0B>&U_15XyPzJ7Z@&;tX0mnfi{ve_O3bv#G(I8Qspdd=`TUOw(w~HIy!F;7pjCLFak2KSuUNHo0$cq9FbH;aM8nr)I8E(rB~+zi&;$QU>KvpZYy zD>ukd5a$0Tsdv0Lp2MTL>sHPt%#rC&W0AH7DVEC2mIKAx9fYKmQSxG^Ze(fx8XW zw9H7K_Pv>X()|4HzX9B%NHId5;5@;Y5I<_G+bLmmeX}HlPj00M<5F8S>zYdWg{%xa z7p1GESxT>aeK5oJU2h1JvUXN|v{Gm%8V)c*H=jlG#JpOoy2TX&KBX_><`ibkN(>r^Zg-$98vzn#%r^ML2{Rks N5l)e^BAhV;WPb_*KtTWi diff --git a/target/classes/conekta/io/model/impl/Webhook.class b/target/classes/conekta/io/model/impl/Webhook.class deleted file mode 100644 index 2c98f83d576236de05927435766522391cac9c0c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 290 zcmaKny>7xl5QJy_8ypiO`Y56!DRN~B5KSa13knd_XXk_u&c4VP-irz;MIImz6|qLt z>`J4ZPrD=S-~Z1qfDiN{xafv>3Xu?kv95G8A-KcW6~X(oUy6{Vx>B=4nW=gyGsC2x z+FY8Itaa;e&}$04C%mM&t<?XEDg+K73!Re6H}9R8y%;^q+6fStH{z<)b~P7EA`tN~;2!2@f2oqco= Ku_HXPI*2dBZ9d!p From eab59ad951d0150ffd02547a457ac32fa5a128d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Rosemberg?= Date: Fri, 1 Jul 2022 12:12:22 -0300 Subject: [PATCH 06/24] Delete .idea directory --- .idea/.gitignore | 8 -- .idea/compiler.xml | 13 --- .idea/encodings.xml | 7 -- .idea/jarRepositories.xml | 20 ----- .idea/misc.xml | 14 ---- .idea/sonarlint/issuestore/index.pb | 0 .idea/uiDesigner.xml | 124 ---------------------------- .idea/vcs.xml | 6 -- 8 files changed, 192 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/jarRepositories.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/sonarlint/issuestore/index.pb delete mode 100644 .idea/uiDesigner.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 41e5941..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index aa00ffa..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml deleted file mode 100644 index 712ab9d..0000000 --- a/.idea/jarRepositories.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index d24ea8e..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/sonarlint/issuestore/index.pb b/.idea/sonarlint/issuestore/index.pb deleted file mode 100644 index e69de29..0000000 diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml deleted file mode 100644 index e96534f..0000000 --- a/.idea/uiDesigner.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From 25ce739f8d2b71b3442d9f3da82cc52ce2564a32 Mon Sep 17 00:00:00 2001 From: Matias Date: Thu, 28 Jul 2022 11:28:05 -0300 Subject: [PATCH 07/24] attributes --- .../java/conekta/io/model/ConektaObject.java | 9 ++------ .../java/conekta/io/model/impl/Customer.java | 22 +++++++++++++++++++ .../conekta/io/model/submodel/Address.java | 15 +++++++++++++ .../io/model/submodel/AntifraudInfo.java | 9 ++++++++ .../submodel/PaginatedConektaObject.java | 15 +++++++++++++ .../io/model/submodel/PaymentSource.java | 14 ++++++++++++ .../io/model/submodel/ShippingContact.java | 9 ++++++++ 7 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 src/main/java/conekta/io/model/submodel/Address.java create mode 100644 src/main/java/conekta/io/model/submodel/AntifraudInfo.java create mode 100644 src/main/java/conekta/io/model/submodel/PaginatedConektaObject.java diff --git a/src/main/java/conekta/io/model/ConektaObject.java b/src/main/java/conekta/io/model/ConektaObject.java index a677156..f0997ba 100644 --- a/src/main/java/conekta/io/model/ConektaObject.java +++ b/src/main/java/conekta/io/model/ConektaObject.java @@ -2,14 +2,9 @@ import lombok.Data; -@Data public abstract class ConektaObject { -private String id; -private String object; - -public String parseToString(){ - return this.toString(); -} + private String id; + private String object; } diff --git a/src/main/java/conekta/io/model/impl/Customer.java b/src/main/java/conekta/io/model/impl/Customer.java index 5a3f5ae..b69a420 100644 --- a/src/main/java/conekta/io/model/impl/Customer.java +++ b/src/main/java/conekta/io/model/impl/Customer.java @@ -1,6 +1,28 @@ package conekta.io.model.impl; import conekta.io.model.ConektaObject; +import conekta.io.model.submodel.AntifraudInfo; +import conekta.io.model.submodel.PaymentSource; +import conekta.io.model.submodel.ShippingContact; +import lombok.Data; +import java.util.List; + +@Data public class Customer extends ConektaObject { + + private Boolean livemode; + private String name; + private String email; + private String phone; + private String defaultShippingContactId; + private Long createdAt; + private Boolean corporate; + private String customReference; + private AntifraudInfo antifraudInfo; + private String defaultPaymentSourceId; + private List paymentSources; + private List shippingContacts; + + } diff --git a/src/main/java/conekta/io/model/submodel/Address.java b/src/main/java/conekta/io/model/submodel/Address.java new file mode 100644 index 0000000..603a0a3 --- /dev/null +++ b/src/main/java/conekta/io/model/submodel/Address.java @@ -0,0 +1,15 @@ +package conekta.io.model.submodel; + +import conekta.io.model.ConektaObject; +import lombok.Data; + +@Data +public class Address extends ConektaObject { + private String street1; + private String street2; + private String city; + private String state; + private String country; + private Boolean residential; + private String postalCode; +} diff --git a/src/main/java/conekta/io/model/submodel/AntifraudInfo.java b/src/main/java/conekta/io/model/submodel/AntifraudInfo.java new file mode 100644 index 0000000..6c95b01 --- /dev/null +++ b/src/main/java/conekta/io/model/submodel/AntifraudInfo.java @@ -0,0 +1,9 @@ +package conekta.io.model.submodel; + +import lombok.Data; + +@Data +public class AntifraudInfo { + Long firstPaidAt; + Long accountCreatedAt; +} diff --git a/src/main/java/conekta/io/model/submodel/PaginatedConektaObject.java b/src/main/java/conekta/io/model/submodel/PaginatedConektaObject.java new file mode 100644 index 0000000..9b7cacb --- /dev/null +++ b/src/main/java/conekta/io/model/submodel/PaginatedConektaObject.java @@ -0,0 +1,15 @@ +package conekta.io.model.submodel; + +import conekta.io.model.ConektaObject; +import lombok.Data; +import java.util.*; + +@Data +public class PaginatedConektaObject { + + private List data; + private boolean hasMore; + private int total; + private String object; + +} \ No newline at end of file diff --git a/src/main/java/conekta/io/model/submodel/PaymentSource.java b/src/main/java/conekta/io/model/submodel/PaymentSource.java index 3b21570..4e450ed 100644 --- a/src/main/java/conekta/io/model/submodel/PaymentSource.java +++ b/src/main/java/conekta/io/model/submodel/PaymentSource.java @@ -1,6 +1,20 @@ package conekta.io.model.submodel; import conekta.io.model.ConektaObject; +import lombok.Data; +@Data public class PaymentSource extends ConektaObject { + private String type; + private Long createdAt; + private String last4; + private String bin; + private String cardType; + private String expMonth; + private String expYear; + private String brand; + private String name; + private String parentId; + private Boolean isDefault; + private Boolean visibleOnCheckout; } diff --git a/src/main/java/conekta/io/model/submodel/ShippingContact.java b/src/main/java/conekta/io/model/submodel/ShippingContact.java index 4c93e87..27dcd62 100644 --- a/src/main/java/conekta/io/model/submodel/ShippingContact.java +++ b/src/main/java/conekta/io/model/submodel/ShippingContact.java @@ -1,6 +1,15 @@ package conekta.io.model.submodel; import conekta.io.model.ConektaObject; +import lombok.Data; +@Data public class ShippingContact extends ConektaObject { + private String receiver; + private String phone; + private String betweenStreets; + private Address address; + private Long createdAt; + private String parentId; + private Boolean isDefault; } From 7997eb3df6c86ff50e9b3ff45c245f9b6e07707e Mon Sep 17 00:00:00 2001 From: Matias Date: Thu, 28 Jul 2022 11:31:08 -0300 Subject: [PATCH 08/24] attributes --- .../java/conekta/io/model/ConektaObject.java | 3 +++ target/classes/conekta/io/Startup.class | Bin 386 -> 0 bytes .../conekta/io/client/ConektaRequestor.class | Bin 1859 -> 3454 bytes .../classes/conekta/io/config/Headers.class | Bin 282 -> 382 bytes .../conekta/io/model/ConektaModel.class | Bin 233 -> 0 bytes .../conekta/io/model/impl/Balance.class | Bin 688 -> 304 bytes .../conekta/io/model/impl/Customer.class | Bin 293 -> 862 bytes .../classes/conekta/io/model/impl/List.class | Bin 281 -> 0 bytes .../classes/conekta/io/model/impl/Log.class | Bin 278 -> 292 bytes .../classes/conekta/io/model/impl/Order.class | Bin 284 -> 12439 bytes .../conekta/io/model/impl/PaymentLink.class | Bin 302 -> 0 bytes .../classes/conekta/io/model/impl/Plan.class | Bin 281 -> 295 bytes .../conekta/io/model/impl/Subscription.class | Bin 305 -> 319 bytes .../conekta/io/model/impl/Transaction.class | Bin 302 -> 316 bytes .../conekta/io/model/impl/Transfer.class | Bin 293 -> 307 bytes .../conekta/io/model/impl/Webhook.class | Bin 290 -> 304 bytes 16 files changed, 3 insertions(+) delete mode 100644 target/classes/conekta/io/Startup.class delete mode 100644 target/classes/conekta/io/model/ConektaModel.class delete mode 100644 target/classes/conekta/io/model/impl/List.class delete mode 100644 target/classes/conekta/io/model/impl/PaymentLink.class diff --git a/src/main/java/conekta/io/model/ConektaObject.java b/src/main/java/conekta/io/model/ConektaObject.java index f0997ba..8068f45 100644 --- a/src/main/java/conekta/io/model/ConektaObject.java +++ b/src/main/java/conekta/io/model/ConektaObject.java @@ -7,4 +7,7 @@ public abstract class ConektaObject { private String id; private String object; + public String parseToString() { + return this.toString(); + } } diff --git a/target/classes/conekta/io/Startup.class b/target/classes/conekta/io/Startup.class deleted file mode 100644 index 2a63fc032a5a385936fa60e526b337e7ad8ad4cd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 386 zcmZusJx{|h5Pg?V8UihC#m-hhA|pd97NkxQ3`Jd-oL~i))IrAKe=#93@B{c!h;v#A zq+-c;zW46kJAZwDd;++{IDwC&7{eGNLNrra*(-uSIb9Nh>*hfc`nl5brd=1(+=-%Q zWSBRlsF%VhS8u_J5pRCAKlP#<;wtb%RthG>@a6GxsSK?JiefLZz>$n3b7@O& z^nRz;ztBhe5}fw5JoK$Us;9Fn*^v{Oa{5yH9PMg$H1o|jv$N7)fB*UifFt-x!vID# z9LJc3r}0cHPGCGnOY+yDVFD+m=#;#i*6=JQrS25R8II>Pv|*ZKhU2V;PMp(l9?xr- zMMlFMF0^7EFKBoX7v=0Fj+ZsOf>-6uYx45ChHbdSVQ?%kG>@8=>5VZo#`nxKG)>q! z!O$^nTHdOwqOd&OHTNb zS#hl-T+epWWZM;1j^Sv0`igPgNLs>6<~^^NoTN*jm);Y(<`!+s6=Z@Dk{(}$Tuq%j zbu%l9o@raOw%wN(3~MntWqHDJN<~lP!YbVH;V^88^rNtnskV$~WUtN`#URd>jJaqT zUdbW%GyfI-Xb4}%b4+V7Jx0D-a&{0r!|iyO$t6lfp+e-jg)1WKrNiq)`ek!5IVp^s zaNP8I^Xn!5LT_7;N8g#GG!V$dM!{j=dEdRHG^D%+8 z%DDS~hF>Q=TE;FpS#jEwo1kZ6O;zug;pliA+c~m2a#-ZZ>o9SJ^oQZ3{f)QJg31Zk9W~X`@_*qDEe9y3ZJw>y^KM;n;?cA+N!^#z?|1s#bw;L!Z z)n++)A`au z!F2N~QSCAps{)Q6$xDrl;dnqu*hw^pK|o=X6xQHF;8c3Ur3fF9`HXV$P%yp+f}vMo zT$r7rqb}w3~%c?`#&Nf7^K(Q0rdji2quqY zx(?EPl14^jEO8&~7n(F+h_1~_*ohr9*L?*HW2aiDlZmwC!+)ZY{`AUTMnf5mD`;v! zH)3V*6>Mn03R)QUmZ2@9_1?^HXuCLaAMFol)+uL?Js>k6cRR?19QUDv%t`kNXmstS zyB@S-6a6=1D|%_Io3#4~Nq{`^(YudYvjb(JNpr;Z0%Gk7m%?)V!9laMD zN0!l-SwX)Hb_>I?SfVesjIH;SO&LkQvNK56A#@SeLBf+DA`cLW68V_#r;0L#gE*uJ zPtnW3VHHCPPZ4@abc+5*DAohuDwo5 z*DTi^H@IoJ<(TKT;|_Nnb?#XnI3BU+ILMNr_^SE78MnJ}ePRCNYU|BUA$ewp%#-Ak{aWhjG+w^# zerP^lYt7VFWbk*)PjX>xnGyEtThilUWKdKrsfv}2ayHt=Z1&oNihhp_DGR&Z0rqo1 zmC>sz5-BC$!dbun>BKhqaoDR!tRNPVd9b=G5u~QODr6V%p zavai>CpJYxLg^lN?NU_bh-`<&26(F$SGUp|QSC|Dld{mLgk}XQGLN*-89%4p-sho2 J7nC3Sxj#$-OSb?3 diff --git a/target/classes/conekta/io/config/Headers.class b/target/classes/conekta/io/config/Headers.class index 736a6884c6675dd2224948033b44ed6fed028eca..2ac01f4de8b885a5d3627e582b3bf431c16803fb 100644 GIT binary patch delta 225 zcmbQm^p8p6)W2Q(7#JAL8AP}kSQrF27zEiFgxDE`CyJ&haHgl0_+%EBq^2-3h-hf~ zWF?j*>gOcprRxWm6lLb6Pb`z?WMyDuWME)qkenDRIdO|vJu}c05MTm|0p)-sJCLUj zq=Cv9Shcn@Fm41(a{x(@Gy_lrCy?ZUC}7}X;0E#-fqY&d3DT?!q(SPKg_t$~DJBMl SRyHK9%pk2iV7+``W&8ktb{RJS delta 120 zcmeyzG>b{})W2Q(7#JAL83ec(m>GE48Ti;4_$NxFOq?&n%)-Dr@t{!v6Ho#K7=aKd z1SHvjJbf^qfq_+PI|JiJpa2sCJCI}p3NrvTZ~#djFq@TulYtA!V`Sh4l1vOd07$G0 A@c;k- diff --git a/target/classes/conekta/io/model/ConektaModel.class b/target/classes/conekta/io/model/ConektaModel.class deleted file mode 100644 index 1967070c44bb79ac8a5a3feed1e170ba71be1f35..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 233 zcmYk0%?`mp6ot=Je<%_jfHfPlw6K(j1(EOsqrIwCGmTC?oP`JQP~w&@Y|fW+@3}v( z_u~m*j(&h{fSy1rAuBMROgEXjE2+uKv$cg>v+SuXj4o**;1;IjoL?2Ovc&$B>X>~@ zIn_QqnCceMD$UspmqydYs;%Mntlldyihebj8hNej@;@Xn_@2*|PUP;GQDl7q0f(Oj XJeU833oyNge#4+)yCzR`SRI5PL)tXE diff --git a/target/classes/conekta/io/model/impl/Balance.class b/target/classes/conekta/io/model/impl/Balance.class index 8315984d72896db5382a6b0b3d83f62755792e0c..ad8a641419c32c595e881e7a7d4ab7f89ed63986 100644 GIT binary patch delta 148 zcmdnMx`9db)W2Q(7#JAL83ec(m>GE48Ti;4_$NwaC~*bnmlh?bx@G31GBWTuCFUgN zC8z3TC6*=fFt9MNGBU_cOps+}WRROI!zdx+pOlrFT*9Epzyve}1Q>x3s0>K5O%7xf eQ)dT?u>pAuKrs#=$pd9`GH`)aa|1~x1|9&K2Ng^J literal 688 zcma)&%SyvQ6o&sv(?n~u7qtrFZP$u8OBad@3*sUwsB}L~$98I(gk3gj7?52R+; zYqkB6co963nh&*3_%(%lnI&>>`|ltOwP|~rYQXP$BNRw>jB@$t z9qf%B7MA8BkYJhK-b{cBR;Z$pu}aav$CM3hu~!opNN<6(e#x~0WIdOx79g9sWUTYx15PeSb(S)Q4DJ?A@{QwS>1AF9px&KbCvoxGE3dZ_KZ_F* z2YvuQs_Lw>R2zzrIP8pP-pun`&-}Xn@e{xsyy##Jhb=s7;W@*)l2;-zv0&H?FZmS@ z6xZ|Mtuab)Jz}V9o)9>!fD>n>o)gv(373j|x-goGc49H(xpI?*Oj9Zu8|`@H&SQpl zWCeF3K64C%3Rh@6Q#&#?HI^zE`ca-alYA00VTFz;)8pF7ndNzWu4jhfD2(X7FOCP& z1ci7NWchS?IIEVD#_dwmNB%Vt+D%MuBT*>YNUNFbR#xt$3PPDVYHm;DTyvLO5;0n; zzJ-tfA!6mS(J3(vveh@C`%eCY@Q)Yul+9zQr8{LAPq9Z4!#>#>4sHPK COWtb$ delta 122 zcmcb|wvGE48Ti;4_$OarY-46&V4WPvq^vHGl~|UjpOcuE zuJ50em6}|_pvb@kR0{%(KnPR^B-th_GK;CR1I5^YJO-dV2ax0evsoE98Mwfzxq&1T G0}lY02M{O# diff --git a/target/classes/conekta/io/model/impl/List.class b/target/classes/conekta/io/model/impl/List.class deleted file mode 100644 index 02877e4b59990f1d2115989ad64c8bb828268907..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 281 zcmZ{eKTiTd5XIjd_Xo~Xh^3*SQwq1V(9oDrU7*m=?;RT**t<2y;`g#LvET#vp$xOc zmYL*b-Y+vR^ZWO60PuiOjvg*ETxA#%(kE`&&j`KSyA>gRc56czmfV`fzNt+2sw*qx zx^%U+E8TJM|1kFNyd#Xu+O=luwPL3l39yQr535Sv`A0(j;`Uu_<{WYc0p4%)r!Ej9 zA>5q5C5*zNvbud!%W7k4j|n1qKNLwzf@msEojj0Czd>IDB4nbeV8}sVv^dQP2FS$` IE<_^~M^$w@IsgCw diff --git a/target/classes/conekta/io/model/impl/Log.class b/target/classes/conekta/io/model/impl/Log.class index 23917c7ba72779b1ecbd77ea1aadf26f55ca9bfe..c88a6730f00b9de251b7b92d865595badc971c6b 100644 GIT binary patch delta 40 scmbQnw1jEGCP}&E{Jhlcl0^N?eEr<~l++x3XNbVWy*7-j6MxA704~rE4*&oF delta 27 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 bME$*(!aa$-xLwSMNixI$+Htf8aSeSNA6rIp delta 167 zcmbQ9IEP8})W2Q(7#JAL83ec(m>GE48Ti;4_$M!BPLt&d&Mz%WPIb%7No8c<@-IqB zEz-+MEKB5JU}0dLY|AH?#>gN5641{{%uCnzPs&P7E@4n)U;>&00*pWiR0$;6fINLL tpMil@YdZtuMxX!_13Qpp0}3+$HE;k)9x$7gfs=s?$YW&S29it+JOE#}7~%i` diff --git a/target/classes/conekta/io/model/impl/PaymentLink.class b/target/classes/conekta/io/model/impl/PaymentLink.class deleted file mode 100644 index 0528d1348cfd8d5ca0daacdb0fa92aa97fa738ba..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 302 zcmaiv&1wQM6otHKlBa6P1{AY?4reu;A*Hsi~GzN+Gr*z(%Sk@ibWiiIjY`Uv<>%^|)FVvX5}lLw-w9carzfP^*X7+knv Q%}#TKTcqp=cdP-je~*v$3_J{sK$4Y#lYt9J MGcs@kNhSs!0GNjkHvj+t delta 51 zcmdnbw2^7TS#E)>#Ii*FoW#6z{fW*v$3_J{sK$4Y#lYt9J MGcs@kNhSs!0G0C&D*ylh delta 27 jcmdnPw2o=QDQ075t<8 delta 51 zcmdnYw3KPWL2iMp#Ii*FoW#6z{fW11WSJQ_7#J9M7#M*hD+4D37m#LT;0BUR3_Ji& CkqCJJ diff --git a/target/classes/conekta/io/model/impl/Webhook.class b/target/classes/conekta/io/model/impl/Webhook.class index 2c98f83d576236de05927435766522391cac9c0c..755b9596c73ee0c8fb0ac57bf4361027ab8f5497 100644 GIT binary patch delta 65 zcmZ3)w1H{DK1sRc{Jhlcl0^N?eEr<~l++x3XNbVWlQy!f3>*v$3_J{sK$4Y#lYt9J MGcs@kNhSs!0E?py`v3p{ delta 51 zcmdnMw1{cKK5l`m#Ii*FoW#6z{fXCYWSJQ_7#J9M7#M*hD+4D37m#LT;0BUR3_Ji$ CdkAd+ From f28673b0c87a00b98bc93843da88a137318ca1ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Rosemberg?= Date: Thu, 28 Jul 2022 11:34:49 -0300 Subject: [PATCH 09/24] Delete target/classes/conekta/io directory --- .../conekta/io/client/ConektaRequestor.class | Bin 3454 -> 0 bytes target/classes/conekta/io/config/Headers.class | Bin 382 -> 0 bytes .../classes/conekta/io/model/impl/Balance.class | Bin 304 -> 0 bytes .../conekta/io/model/impl/Customer.class | Bin 862 -> 0 bytes target/classes/conekta/io/model/impl/Log.class | Bin 292 -> 0 bytes .../classes/conekta/io/model/impl/Order.class | Bin 12439 -> 0 bytes target/classes/conekta/io/model/impl/Plan.class | Bin 295 -> 0 bytes .../conekta/io/model/impl/Subscription.class | Bin 319 -> 0 bytes .../conekta/io/model/impl/Transaction.class | Bin 316 -> 0 bytes .../conekta/io/model/impl/Transfer.class | Bin 307 -> 0 bytes .../classes/conekta/io/model/impl/Webhook.class | Bin 304 -> 0 bytes 11 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 target/classes/conekta/io/client/ConektaRequestor.class delete mode 100644 target/classes/conekta/io/config/Headers.class delete mode 100644 target/classes/conekta/io/model/impl/Balance.class delete mode 100644 target/classes/conekta/io/model/impl/Customer.class delete mode 100644 target/classes/conekta/io/model/impl/Log.class delete mode 100644 target/classes/conekta/io/model/impl/Order.class delete mode 100644 target/classes/conekta/io/model/impl/Plan.class delete mode 100644 target/classes/conekta/io/model/impl/Subscription.class delete mode 100644 target/classes/conekta/io/model/impl/Transaction.class delete mode 100644 target/classes/conekta/io/model/impl/Transfer.class delete mode 100644 target/classes/conekta/io/model/impl/Webhook.class diff --git a/target/classes/conekta/io/client/ConektaRequestor.class b/target/classes/conekta/io/client/ConektaRequestor.class deleted file mode 100644 index a4c40bd516941a06eb48b62ca171038188a9feb7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3454 zcmc&%TX)k&5dJoavqVuY4GAOxQW63f6L5i23=U~YfF?8n8i%y>iefLZz>$n3b7@O& z^nRz;ztBhe5}fw5JoK$Us;9Fn*^v{Oa{5yH9PMg$H1o|jv$N7)fB*UifFt-x!vID# z9LJc3r}0cHPGCGnOY+yDVFD+m=#;#i*6=JQrS25R8II>Pv|*ZKhU2V;PMp(l9?xr- zMMlFMF0^7EFKBoX7v=0Fj+ZsOf>-6uYx45ChHbdSVQ?%kG>@8=>5VZo#`nxKG)>q! z!O$^nTHdOwqOd&OHTNb zS#hl-T+epWWZM;1j^Sv0`igPgNLs>6<~^^NoTN*jm);Y(<`!+s6=Z@Dk{(}$Tuq%j zbu%l9o@raOw%wN(3~MntWqHDJN<~lP!YbVH;V^88^rNtnskV$~WUtN`#URd>jJaqT zUdbW%GyfI-Xb4}%b4+V7Jx0D-a&{0r!|iyO$t6lfp+e-jg)1WKrNiq)`ek!5IVp^s zaNP8I^Xn!5LT_7;N8g#GG!V$dM!{j=dEdRHG^D%+8 z%DDS~hF>Q=TE;FpS#jEwo1kZ6O;zug;pliA+c~m2a#-ZZ>o9SJ^oQZ3{f)QJg31Zk9W~X`@_*qDEe9y3ZJw>y^KM;n;?cA+N!^#z?|1s#bw;L!Z z)n++)A`au z!F2N~QSCAps{)Q6$xDrl;dnqu*hw^pK|o=X6xQHF;8c3Ur3fF9`HXV$P%yp+f}vMo zT$r7rqb}w3~%c?`#&Nf7^K(Q0rdji2quqY zx(?EPl14^jEO8&~7n(F+h_1~_*ohr9*L?*HW2aiDlZmwC!+)ZY{`AUTMnf5mD`;v! zH)3V*6>Mn03R)QUmZ2@9_1?^HXuCLaAMFol)+uL?Js>k6cRR?19QUDv%t`kNXmstS zyB@S-6a6=1D|%_Io3#4~Nq{`^(YudYvjb(JNpr;Z0%Gk7m%?)V!9laMD zN0!l-SwX)Hb_>I?SfVesjIH;SO&LkQvNK56A#@SeLBf+DA`cLW68V_#r;0L#gE*uJ zPtnW3VHHCPPZ4@abc+5*DAohuDw{O7y-zdQT$>-_`3DaJ7ZjQZG(kVe=egy*`^_JZI~rgK7Y*_Mhh%ygq}mQT4d zcQUWJl4flo>$x=AhD$|`229>gz?yM>aowDeHHQ_zFreY0KY+D*2k(f{SC;K3izA0?e= zZUtxHG4C6A!~C9)Cje7)BQ)?3q8*|`2wqHX%2z_;X|y5uGxx3uoy6pNvCC3jtYvDM z^b)6}-N?dJzJ`AJVZI5&M7dmlmQoleG7hl9WM5XiNh@=up9#^*?FyymrizMdKH18> zjNzk6=-*5r4F2tB*OSY1t5u0dc>GmW#Lbbc0XuQ=Ky&;9Ixz4MvIdM9qQx55^Bp2~ JgnL#G@gKn1L+=0p diff --git a/target/classes/conekta/io/model/impl/Customer.class b/target/classes/conekta/io/model/impl/Customer.class deleted file mode 100644 index 3e86781abaa5295daaa4a1e89f4133a32f6b8afc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 862 zcmb7CO>Yx15PeSb(S)Q4DJ?A@{QwS>1AF9px&KbCvoxGE3dZ_KZ_F* z2YvuQs_Lw>R2zzrIP8pP-pun`&-}Xn@e{xsyy##Jhb=s7;W@*)l2;-zv0&H?FZmS@ z6xZ|Mtuab)Jz}V9o)9>!fD>n>o)gv(373j|x-goGc49H(xpI?*Oj9Zu8|`@H&SQpl zWCeF3K64C%3Rh@6Q#&#?HI^zE`ca-alYA00VTFz;)8pF7ndNzWu4jhfD2(X7FOCP& z1ci7NWchS?IIEVD#_dwmNB%Vt+D%MuBT*>YNUNFbR#xt$3PPDVYHm;DTyvLO5;0n; zzJ-tfA!6mS(J3(vveh@C`%eCY@Q)Yul+9zQr8{LAPq9Z4!#>#>4sHPK COWtb$ diff --git a/target/classes/conekta/io/model/impl/Log.class b/target/classes/conekta/io/model/impl/Log.class deleted file mode 100644 index c88a6730f00b9de251b7b92d865595badc971c6b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 292 zcmZ{fKT88a5XIlz-{f*JA)N?9I!%!+Qz$k8t0NYM^n2@)?74RvE_Z&fRDy*czz-Fi z({$ntJof#DdCPpAK0W~~FizlO7~>+wh!EYI$}|rI|K@f>2$t?e6GoY-^r|g$U9V+s znM^XLq}|Bcbp8y3W@iqBt4z5{zcx}BCrS>m!jyX}GPk`WB+ss`m3}l`Opn>TkZ&?Y zfRJ$c?nkAxjz I!0I9W1{$G1R{#J2 diff --git a/target/classes/conekta/io/model/impl/Order.class b/target/classes/conekta/io/model/impl/Order.class deleted file mode 100644 index 7e52b5d560cf2f119ca4d139458a320a1ed03b73..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12439 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 bME$*(!aa$-xLwSMNixI$+Htf8aSeSNA6rIp diff --git a/target/classes/conekta/io/model/impl/Plan.class b/target/classes/conekta/io/model/impl/Plan.class deleted file mode 100644 index c856c6e14d3814bffa51e7209d4ee10a45a9054d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 295 zcmZ{fPiw+J5XIlbm}rcD@F*g9vmV@|hZZk_r(g?;_f1@Ib(57C`@K9Bdguq}hY}~P zH*p3Y`+mc`Wqz;UKLDoa1gN0tqvfMb@ZNN$iy5IZdf5=%x!o#4JJOk2p3_+6YZ)6R z-N+`=Y-FxWe}`_d(=>CuP}BePdRu(IboQ43w>)Jr(o%TF1? zMU~KdzDpQ94Cntpy~lf%6d1zcW6C0K&SUl1i9Zii$6ufe0|!2<$Cx2%tl|A#N5GEI IV094Q08LFml>h($ diff --git a/target/classes/conekta/io/model/impl/Subscription.class b/target/classes/conekta/io/model/impl/Subscription.class deleted file mode 100644 index 571a85823b3e634145aeeb58a02d637d90fb7860..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 319 zcmaiv!A`oiL2le0{Jz%_$aBB1b;l5oqaj@-@vh}?DS>rK8AV;=E(vmA0iBmrw=-%x>TLA%L(MYgB RoQS5!cMpj;!l`J0^c%?JOB(Y$~GO_Rhd?@1_ zP>@hKll zN3+pdzv~<^x`e^MNran|oyq?DdAYVGV1P(2Y>T8NRx}Z(b{^;sKS3V?BBY{;V1YOj P%@6N$Wa0=Hq7m{xP0~r5 diff --git a/target/classes/conekta/io/model/impl/Transfer.class b/target/classes/conekta/io/model/impl/Transfer.class deleted file mode 100644 index ff1d198ff428695ac04617b57d92127bc45228c0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 307 zcmaKnJ#NB45QX2^#wL#W5eGn|BPp^a1rZGrl?4Tee(h|;I<^-rhI^$#qTm2IRKz%e zE@DP{+V{=qt>*jZbOta&H-w8;fOdcm!GF`Gt|kO`_`D`~Q}eC}omiJ@zAqAGS2D?& z^kS3Bd@Zf6{S|uEM(+rNI5nmEtfbIJ6daHXU2Jo)va;NLC_5&EOS8ABn&~>LbsM~9 z@*pF4Xb}4MGyYqc{{6a0GL=?%g2RW^Mckap>a!ES9%#HAL0=3U1gt(|hG?=z*Y^WL Kc7#V(2hjy)9!1Xp diff --git a/target/classes/conekta/io/model/impl/Webhook.class b/target/classes/conekta/io/model/impl/Webhook.class deleted file mode 100644 index 755b9596c73ee0c8fb0ac57bf4361027ab8f5497..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 304 zcmaKnL2JT55QX0)F{v?D>0QN}dT@^(lwJf+p&lysyon30CRvHm|K&;Op+CSMB~EN^ zh0efZ-Z$`ux!u2i08G&KVWa8c)kBNm&UB`WcY-|_t_jZEY!smt>P&r{(n#ei86`~K zLKDkmEpuJ^3OdDB9|^rMHksNNQfMPm4oHMf4~h6v(bky#l;D4wQy!~@E~A2qk9YDc z130J=I{zjRx_|cb-;>K|r{V&ASo~F4#LbbcE<5q`Ky7pdT^LyKSY5^p@xmHZa~(cA JLW9*p@Bj=FL}~y4 From d208f12dd2736338e3a820e09fbeca9bc6efe74a Mon Sep 17 00:00:00 2001 From: Matias Date: Mon, 1 Aug 2022 15:20:09 -0300 Subject: [PATCH 10/24] requestor and auth singleton updated --- .../conekta/io/client/ConektaRequestor.java | 4 +- .../io/client/impl/CustomersClient.java | 15 +++++++ .../io/config/ConektaAuthenticator.java | 39 ++++++++---------- .../PaginatedConektaObject.java | 2 +- .../java/conekta/io/model/impl/Order.java | 1 + .../conekta/io/model/submodel/Charge.java | 4 +- .../conekta/io/client/ConektaRequestor.class | Bin 3454 -> 0 bytes .../classes/conekta/io/config/Headers.class | Bin 382 -> 0 bytes .../conekta/io/model/impl/Balance.class | Bin 304 -> 0 bytes .../conekta/io/model/impl/Customer.class | Bin 862 -> 0 bytes .../classes/conekta/io/model/impl/Log.class | Bin 292 -> 0 bytes .../classes/conekta/io/model/impl/Order.class | Bin 12439 -> 0 bytes .../classes/conekta/io/model/impl/Plan.class | Bin 295 -> 0 bytes .../conekta/io/model/impl/Subscription.class | Bin 319 -> 0 bytes .../conekta/io/model/impl/Transaction.class | Bin 316 -> 0 bytes .../conekta/io/model/impl/Transfer.class | Bin 307 -> 0 bytes .../conekta/io/model/impl/Webhook.class | Bin 304 -> 0 bytes 17 files changed, 38 insertions(+), 27 deletions(-) create mode 100644 src/main/java/conekta/io/client/impl/CustomersClient.java rename src/main/java/conekta/io/model/{submodel => }/PaginatedConektaObject.java (87%) delete mode 100644 target/classes/conekta/io/client/ConektaRequestor.class delete mode 100644 target/classes/conekta/io/config/Headers.class delete mode 100644 target/classes/conekta/io/model/impl/Balance.class delete mode 100644 target/classes/conekta/io/model/impl/Customer.class delete mode 100644 target/classes/conekta/io/model/impl/Log.class delete mode 100644 target/classes/conekta/io/model/impl/Order.class delete mode 100644 target/classes/conekta/io/model/impl/Plan.class delete mode 100644 target/classes/conekta/io/model/impl/Subscription.class delete mode 100644 target/classes/conekta/io/model/impl/Transaction.class delete mode 100644 target/classes/conekta/io/model/impl/Transfer.class delete mode 100644 target/classes/conekta/io/model/impl/Webhook.class diff --git a/src/main/java/conekta/io/client/ConektaRequestor.java b/src/main/java/conekta/io/client/ConektaRequestor.java index 3478466..2f489cc 100644 --- a/src/main/java/conekta/io/client/ConektaRequestor.java +++ b/src/main/java/conekta/io/client/ConektaRequestor.java @@ -13,7 +13,7 @@ import java.net.http.HttpResponse; import java.time.Duration; -public class ConektaRequestor { +public interface ConektaRequestor { private HttpResponse send(HttpRequest request){ try { @@ -29,7 +29,7 @@ private HttpResponse send(HttpRequest request){ } } - public HttpResponse doRequest(ConektaObject conektaObject, Headers headers, String url , String method){ + default HttpResponse doRequest(ConektaObject conektaObject, Headers headers, String url, String method){ HttpRequest request = HttpRequest.newBuilder() .method(method, HttpRequest.BodyPublishers.ofString(conektaObject.parseToString())) .uri(URI.create(url)) diff --git a/src/main/java/conekta/io/client/impl/CustomersClient.java b/src/main/java/conekta/io/client/impl/CustomersClient.java new file mode 100644 index 0000000..ec7e93e --- /dev/null +++ b/src/main/java/conekta/io/client/impl/CustomersClient.java @@ -0,0 +1,15 @@ +package conekta.io.client.impl; + +import conekta.io.client.ConektaRequestor; +import conekta.io.config.Headers; +import conekta.io.model.ConektaObject; +import conekta.io.model.impl.Customer; + +import java.net.http.HttpResponse; + +public class CustomersClient implements ConektaRequestor { + + public HttpResponse getClientList(ConektaObject conektaObject, Headers headers, String url, String method) { + return ConektaRequestor.super.doRequest(conektaObject, headers, url, method); + } +} diff --git a/src/main/java/conekta/io/config/ConektaAuthenticator.java b/src/main/java/conekta/io/config/ConektaAuthenticator.java index fe47193..d52074f 100644 --- a/src/main/java/conekta/io/config/ConektaAuthenticator.java +++ b/src/main/java/conekta/io/config/ConektaAuthenticator.java @@ -4,35 +4,32 @@ import java.net.PasswordAuthentication; public class ConektaAuthenticator { - private static String username; - private static String password; - private ConektaAuthenticator() { - // The only wait to create user and password is to set manually before using the library. - } + private static ConektaAuthenticator conektaAuthenticator = null; + private static String username = null; + private static String password = null; - public static Authenticator getBasicAuthenticator(){ - return new Authenticator() { - @Override - protected PasswordAuthentication getPasswordAuthentication() { - return new PasswordAuthentication(getUsername(), getPassword().toCharArray()); - } - }; + private ConektaAuthenticator(){ } - public static void setUsername(String username) { - ConektaAuthenticator.username = username; + public static ConektaAuthenticator getInstance() { + if (conektaAuthenticator == null) { + conektaAuthenticator = new ConektaAuthenticator(); + } + return conektaAuthenticator; } - public static void setPassword(String password) { + public static void setCredentials(String username, String password) { + ConektaAuthenticator.username = username; ConektaAuthenticator.password = password; } - public static String getUsername() { - return username; - } - - public static String getPassword() { - return password; + public static Authenticator getBasicAuthenticator() { + return new Authenticator() { + @Override + public PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password.toCharArray()); + } + }; } } diff --git a/src/main/java/conekta/io/model/submodel/PaginatedConektaObject.java b/src/main/java/conekta/io/model/PaginatedConektaObject.java similarity index 87% rename from src/main/java/conekta/io/model/submodel/PaginatedConektaObject.java rename to src/main/java/conekta/io/model/PaginatedConektaObject.java index 9b7cacb..f43c1ee 100644 --- a/src/main/java/conekta/io/model/submodel/PaginatedConektaObject.java +++ b/src/main/java/conekta/io/model/PaginatedConektaObject.java @@ -1,4 +1,4 @@ -package conekta.io.model.submodel; +package conekta.io.model; import conekta.io.model.ConektaObject; import lombok.Data; diff --git a/src/main/java/conekta/io/model/impl/Order.java b/src/main/java/conekta/io/model/impl/Order.java index b56625e..8868f2d 100644 --- a/src/main/java/conekta/io/model/impl/Order.java +++ b/src/main/java/conekta/io/model/impl/Order.java @@ -8,6 +8,7 @@ @Data public class Order extends ConektaObject { + private String createdAt; private String updatedAt; private String currency; diff --git a/src/main/java/conekta/io/model/submodel/Charge.java b/src/main/java/conekta/io/model/submodel/Charge.java index c60de43..8c9f16a 100644 --- a/src/main/java/conekta/io/model/submodel/Charge.java +++ b/src/main/java/conekta/io/model/submodel/Charge.java @@ -1,6 +1,4 @@ package conekta.io.model.submodel; -import conekta.io.model.ConektaObject; - -public class Charge extends ConektaObject { +public class Charge { } diff --git a/target/classes/conekta/io/client/ConektaRequestor.class b/target/classes/conekta/io/client/ConektaRequestor.class deleted file mode 100644 index a4c40bd516941a06eb48b62ca171038188a9feb7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3454 zcmc&%TX)k&5dJoavqVuY4GAOxQW63f6L5i23=U~YfF?8n8i%y>iefLZz>$n3b7@O& z^nRz;ztBhe5}fw5JoK$Us;9Fn*^v{Oa{5yH9PMg$H1o|jv$N7)fB*UifFt-x!vID# z9LJc3r}0cHPGCGnOY+yDVFD+m=#;#i*6=JQrS25R8II>Pv|*ZKhU2V;PMp(l9?xr- zMMlFMF0^7EFKBoX7v=0Fj+ZsOf>-6uYx45ChHbdSVQ?%kG>@8=>5VZo#`nxKG)>q! z!O$^nTHdOwqOd&OHTNb zS#hl-T+epWWZM;1j^Sv0`igPgNLs>6<~^^NoTN*jm);Y(<`!+s6=Z@Dk{(}$Tuq%j zbu%l9o@raOw%wN(3~MntWqHDJN<~lP!YbVH;V^88^rNtnskV$~WUtN`#URd>jJaqT zUdbW%GyfI-Xb4}%b4+V7Jx0D-a&{0r!|iyO$t6lfp+e-jg)1WKrNiq)`ek!5IVp^s zaNP8I^Xn!5LT_7;N8g#GG!V$dM!{j=dEdRHG^D%+8 z%DDS~hF>Q=TE;FpS#jEwo1kZ6O;zug;pliA+c~m2a#-ZZ>o9SJ^oQZ3{f)QJg31Zk9W~X`@_*qDEe9y3ZJw>y^KM;n;?cA+N!^#z?|1s#bw;L!Z z)n++)A`au z!F2N~QSCAps{)Q6$xDrl;dnqu*hw^pK|o=X6xQHF;8c3Ur3fF9`HXV$P%yp+f}vMo zT$r7rqb}w3~%c?`#&Nf7^K(Q0rdji2quqY zx(?EPl14^jEO8&~7n(F+h_1~_*ohr9*L?*HW2aiDlZmwC!+)ZY{`AUTMnf5mD`;v! zH)3V*6>Mn03R)QUmZ2@9_1?^HXuCLaAMFol)+uL?Js>k6cRR?19QUDv%t`kNXmstS zyB@S-6a6=1D|%_Io3#4~Nq{`^(YudYvjb(JNpr;Z0%Gk7m%?)V!9laMD zN0!l-SwX)Hb_>I?SfVesjIH;SO&LkQvNK56A#@SeLBf+DA`cLW68V_#r;0L#gE*uJ zPtnW3VHHCPPZ4@abc+5*DAohuDw{O7y-zdQT$>-_`3DaJ7ZjQZG(kVe=egy*`^_JZI~rgK7Y*_Mhh%ygq}mQT4d zcQUWJl4flo>$x=AhD$|`229>gz?yM>aowDeHHQ_zFreY0KY+D*2k(f{SC;K3izA0?e= zZUtxHG4C6A!~C9)Cje7)BQ)?3q8*|`2wqHX%2z_;X|y5uGxx3uoy6pNvCC3jtYvDM z^b)6}-N?dJzJ`AJVZI5&M7dmlmQoleG7hl9WM5XiNh@=up9#^*?FyymrizMdKH18> zjNzk6=-*5r4F2tB*OSY1t5u0dc>GmW#Lbbc0XuQ=Ky&;9Ixz4MvIdM9qQx55^Bp2~ JgnL#G@gKn1L+=0p diff --git a/target/classes/conekta/io/model/impl/Customer.class b/target/classes/conekta/io/model/impl/Customer.class deleted file mode 100644 index 3e86781abaa5295daaa4a1e89f4133a32f6b8afc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 862 zcmb7CO>Yx15PeSb(S)Q4DJ?A@{QwS>1AF9px&KbCvoxGE3dZ_KZ_F* z2YvuQs_Lw>R2zzrIP8pP-pun`&-}Xn@e{xsyy##Jhb=s7;W@*)l2;-zv0&H?FZmS@ z6xZ|Mtuab)Jz}V9o)9>!fD>n>o)gv(373j|x-goGc49H(xpI?*Oj9Zu8|`@H&SQpl zWCeF3K64C%3Rh@6Q#&#?HI^zE`ca-alYA00VTFz;)8pF7ndNzWu4jhfD2(X7FOCP& z1ci7NWchS?IIEVD#_dwmNB%Vt+D%MuBT*>YNUNFbR#xt$3PPDVYHm;DTyvLO5;0n; zzJ-tfA!6mS(J3(vveh@C`%eCY@Q)Yul+9zQr8{LAPq9Z4!#>#>4sHPK COWtb$ diff --git a/target/classes/conekta/io/model/impl/Log.class b/target/classes/conekta/io/model/impl/Log.class deleted file mode 100644 index c88a6730f00b9de251b7b92d865595badc971c6b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 292 zcmZ{fKT88a5XIlz-{f*JA)N?9I!%!+Qz$k8t0NYM^n2@)?74RvE_Z&fRDy*czz-Fi z({$ntJof#DdCPpAK0W~~FizlO7~>+wh!EYI$}|rI|K@f>2$t?e6GoY-^r|g$U9V+s znM^XLq}|Bcbp8y3W@iqBt4z5{zcx}BCrS>m!jyX}GPk`WB+ss`m3}l`Opn>TkZ&?Y zfRJ$c?nkAxjz I!0I9W1{$G1R{#J2 diff --git a/target/classes/conekta/io/model/impl/Order.class b/target/classes/conekta/io/model/impl/Order.class deleted file mode 100644 index 7e52b5d560cf2f119ca4d139458a320a1ed03b73..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12439 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 bME$*(!aa$-xLwSMNixI$+Htf8aSeSNA6rIp diff --git a/target/classes/conekta/io/model/impl/Plan.class b/target/classes/conekta/io/model/impl/Plan.class deleted file mode 100644 index c856c6e14d3814bffa51e7209d4ee10a45a9054d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 295 zcmZ{fPiw+J5XIlbm}rcD@F*g9vmV@|hZZk_r(g?;_f1@Ib(57C`@K9Bdguq}hY}~P zH*p3Y`+mc`Wqz;UKLDoa1gN0tqvfMb@ZNN$iy5IZdf5=%x!o#4JJOk2p3_+6YZ)6R z-N+`=Y-FxWe}`_d(=>CuP}BePdRu(IboQ43w>)Jr(o%TF1? zMU~KdzDpQ94Cntpy~lf%6d1zcW6C0K&SUl1i9Zii$6ufe0|!2<$Cx2%tl|A#N5GEI IV094Q08LFml>h($ diff --git a/target/classes/conekta/io/model/impl/Subscription.class b/target/classes/conekta/io/model/impl/Subscription.class deleted file mode 100644 index 571a85823b3e634145aeeb58a02d637d90fb7860..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 319 zcmaiv!A`oiL2le0{Jz%_$aBB1b;l5oqaj@-@vh}?DS>rK8AV;=E(vmA0iBmrw=-%x>TLA%L(MYgB RoQS5!cMpj;!l`J0^c%?JOB(Y$~GO_Rhd?@1_ zP>@hKll zN3+pdzv~<^x`e^MNran|oyq?DdAYVGV1P(2Y>T8NRx}Z(b{^;sKS3V?BBY{;V1YOj P%@6N$Wa0=Hq7m{xP0~r5 diff --git a/target/classes/conekta/io/model/impl/Transfer.class b/target/classes/conekta/io/model/impl/Transfer.class deleted file mode 100644 index ff1d198ff428695ac04617b57d92127bc45228c0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 307 zcmaKnJ#NB45QX2^#wL#W5eGn|BPp^a1rZGrl?4Tee(h|;I<^-rhI^$#qTm2IRKz%e zE@DP{+V{=qt>*jZbOta&H-w8;fOdcm!GF`Gt|kO`_`D`~Q}eC}omiJ@zAqAGS2D?& z^kS3Bd@Zf6{S|uEM(+rNI5nmEtfbIJ6daHXU2Jo)va;NLC_5&EOS8ABn&~>LbsM~9 z@*pF4Xb}4MGyYqc{{6a0GL=?%g2RW^Mckap>a!ES9%#HAL0=3U1gt(|hG?=z*Y^WL Kc7#V(2hjy)9!1Xp diff --git a/target/classes/conekta/io/model/impl/Webhook.class b/target/classes/conekta/io/model/impl/Webhook.class deleted file mode 100644 index 755b9596c73ee0c8fb0ac57bf4361027ab8f5497..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 304 zcmaKnL2JT55QX0)F{v?D>0QN}dT@^(lwJf+p&lysyon30CRvHm|K&;Op+CSMB~EN^ zh0efZ-Z$`ux!u2i08G&KVWa8c)kBNm&UB`WcY-|_t_jZEY!smt>P&r{(n#ei86`~K zLKDkmEpuJ^3OdDB9|^rMHksNNQfMPm4oHMf4~h6v(bky#l;D4wQy!~@E~A2qk9YDc z130J=I{zjRx_|cb-;>K|r{V&ASo~F4#LbbcE<5q`Ky7pdT^LyKSY5^p@xmHZa~(cA JLW9*p@Bj=FL}~y4 From dfaabca37e3e688fa4f58f824e6fba598867f7b1 Mon Sep 17 00:00:00 2001 From: afalla-conekta Date: Mon, 1 Aug 2022 13:54:53 -0500 Subject: [PATCH 11/24] Algunos cambios --- .../conekta/io/client/ConektaRequestor.java | 5 ++-- .../io/client/impl/CustomersClient.java | 11 +++++++-- .../java/conekta/io/config/Constants.java | 24 ++++++++++++++++++- src/main/java/conekta/io/config/Headers.java | 21 ++++++++++++++++ 4 files changed, 55 insertions(+), 6 deletions(-) diff --git a/src/main/java/conekta/io/client/ConektaRequestor.java b/src/main/java/conekta/io/client/ConektaRequestor.java index 2f489cc..c73f97e 100644 --- a/src/main/java/conekta/io/client/ConektaRequestor.java +++ b/src/main/java/conekta/io/client/ConektaRequestor.java @@ -1,7 +1,6 @@ package conekta.io.client; import conekta.io.config.ConektaAuthenticator; -import conekta.io.config.Headers; import conekta.io.error.IOConektaRequestorException; import conekta.io.error.InterruptedConektaRequestorException; import conekta.io.model.ConektaObject; @@ -15,7 +14,7 @@ public interface ConektaRequestor { - private HttpResponse send(HttpRequest request){ + private HttpResponse send(HttpRequest request) { try { return HttpClient.newBuilder() .authenticator(ConektaAuthenticator.getBasicAuthenticator()) @@ -29,7 +28,7 @@ private HttpResponse send(HttpRequest request){ } } - default HttpResponse doRequest(ConektaObject conektaObject, Headers headers, String url, String method){ + default HttpResponse doRequest(ConektaObject conektaObject, String url, String method) { HttpRequest request = HttpRequest.newBuilder() .method(method, HttpRequest.BodyPublishers.ofString(conektaObject.parseToString())) .uri(URI.create(url)) diff --git a/src/main/java/conekta/io/client/impl/CustomersClient.java b/src/main/java/conekta/io/client/impl/CustomersClient.java index ec7e93e..daa9764 100644 --- a/src/main/java/conekta/io/client/impl/CustomersClient.java +++ b/src/main/java/conekta/io/client/impl/CustomersClient.java @@ -1,15 +1,22 @@ package conekta.io.client.impl; import conekta.io.client.ConektaRequestor; +import conekta.io.config.Constants; import conekta.io.config.Headers; import conekta.io.model.ConektaObject; -import conekta.io.model.impl.Customer; import java.net.http.HttpResponse; public class CustomersClient implements ConektaRequestor { - public HttpResponse getClientList(ConektaObject conektaObject, Headers headers, String url, String method) { + public HttpResponse getCustomerList(ConektaObject conektaObject, Headers headers, String url, String method) { return ConektaRequestor.super.doRequest(conektaObject, headers, url, method); } + + public HttpResponse createCustomer(ConektaObject conektaObject, Headers headers, String url, String method) { + return ConektaRequestor.super.doRequest(conektaObject, + headers, + Constants.API_BASE + Constants.CUSTOMERS_PATH, + "POST"); + } } diff --git a/src/main/java/conekta/io/config/Constants.java b/src/main/java/conekta/io/config/Constants.java index ac041aa..af47823 100644 --- a/src/main/java/conekta/io/config/Constants.java +++ b/src/main/java/conekta/io/config/Constants.java @@ -2,9 +2,31 @@ public class Constants { - public static final String API_BASE = "https://api.conekta.io"; + /** + * + */ + public static final String API_BASE = "https://apipp.conekta.io/"; + //TODO cambiar a produccion + + /** + * + */ public static final String API_VERSION = "2.0.0"; + + /** + * + */ public static final String VERSION = "2.1.1"; + + /* + */ public static final String LOCALE = "es"; + /** + * + */ + public static final String CUSTOMERS_PATH = "cutomers"; + + + } diff --git a/src/main/java/conekta/io/config/Headers.java b/src/main/java/conekta/io/config/Headers.java index cc697d1..cd9db88 100644 --- a/src/main/java/conekta/io/config/Headers.java +++ b/src/main/java/conekta/io/config/Headers.java @@ -1,7 +1,28 @@ package conekta.io.config; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + public class Headers { + + + + + /** + * + */ + public static final String HEADER_1 = "Accept:application/vnd.conekta-v2.0.0+json"; + + + List headers = new Set<>(); + headers.add("Accept:application/vnd.conekta-v2.0.0+json"); + headers.add("Content-Type:application/json; charset=utf-8"); + + + + public String getListed() { return ""; } From 1930e4c3078fc80c7bfc6f604c4e65d34405a9ee Mon Sep 17 00:00:00 2001 From: Matias Date: Mon, 1 Aug 2022 16:39:36 -0300 Subject: [PATCH 12/24] headers modified --- .gitignore | 171 +++++++++++++++++- .../conekta/io/client/ConektaRequestor.java | 4 +- .../io/client/impl/CustomersClient.java | 21 ++- src/main/java/conekta/io/config/Headers.java | 29 --- 4 files changed, 182 insertions(+), 43 deletions(-) delete mode 100644 src/main/java/conekta/io/config/Headers.java diff --git a/.gitignore b/.gitignore index b9b3685..13236bb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -# Created by https://www.toptal.com/developers/gitignore/api/intellij,java,maven -# Edit at https://www.toptal.com/developers/gitignore?templates=intellij,java,maven +# Created by https://www.toptal.com/developers/gitignore/api/intellij,visualstudiocode,java,maven,gradle,intellij+iml,intellij+all +# Edit at https://www.toptal.com/developers/gitignore?templates=intellij,visualstudiocode,java,maven,gradle,intellij+iml,intellij+all ### Intellij ### # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider @@ -114,6 +114,121 @@ fabric.properties # https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij .idea/**/azureSettings.xml +### Intellij+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff + +# AWS User-specific + +# Generated files + +# Sensitive or high-churn files + +# Gradle + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake + +# Mongo Explorer plugin + +# File-based project format + +# IntelliJ + +# mpeltonen/sbt-idea plugin + +# JIRA plugin + +# Cursive Clojure plugin + +# SonarLint plugin + +# Crashlytics plugin (for Android Studio and IntelliJ) + +# Editor-based Rest Client + +# Android studio 3.1+ serialized cache file + +### Intellij+all Patch ### +# Ignore everything but code style settings and run configurations +# that are supposed to be shared within teams. + +.idea/* + +!.idea/codeStyles +!.idea/runConfigurations + +### Intellij+iml ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff + +# AWS User-specific + +# Generated files + +# Sensitive or high-churn files + +# Gradle + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake + +# Mongo Explorer plugin + +# File-based project format + +# IntelliJ + +# mpeltonen/sbt-idea plugin + +# JIRA plugin + +# Cursive Clojure plugin + +# SonarLint plugin + +# Crashlytics plugin (for Android Studio and IntelliJ) + +# Editor-based Rest Client + +# Android studio 3.1+ serialized cache file + +### Intellij+iml Patch ### +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + ### Java ### # Compiled class file *.class @@ -159,4 +274,54 @@ buildNumber.properties # JDT-specific (Eclipse Java Development Tools) .classpath -# End of https://www.toptal.com/developers/gitignore/api/intellij,java,maven \ No newline at end of file +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +# Support for Project snippet scope +.vscode/*.code-snippets + +# Ignore code-workspaces +*.code-workspace + +### Gradle ### +.gradle +**/build/ +!src/**/build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Avoid ignore Gradle wrappper properties +!gradle-wrapper.properties + +# Cache of project +.gradletasknamecache + +# Eclipse Gradle plugin generated files +# Eclipse Core +# JDT-specific (Eclipse Java Development Tools) + +### Gradle Patch ### +# Java heap dump +*.hprof + +# End of https://www.toptal.com/developers/gitignore/api/intellij,visualstudiocode,java,maven,gradle,intellij+iml,intellij+all \ No newline at end of file diff --git a/src/main/java/conekta/io/client/ConektaRequestor.java b/src/main/java/conekta/io/client/ConektaRequestor.java index c73f97e..8be2365 100644 --- a/src/main/java/conekta/io/client/ConektaRequestor.java +++ b/src/main/java/conekta/io/client/ConektaRequestor.java @@ -32,9 +32,9 @@ default HttpResponse doRequest(ConektaObject conektaObject, String url, HttpRequest request = HttpRequest.newBuilder() .method(method, HttpRequest.BodyPublishers.ofString(conektaObject.parseToString())) .uri(URI.create(url)) - .headers(headers.getListed()) + .setHeader("Content-Type", "application/json; charset=utf-8") + .setHeader("Accept", "application/vnd.conekta-v2.0.0+json") .build(); - return send(request); } diff --git a/src/main/java/conekta/io/client/impl/CustomersClient.java b/src/main/java/conekta/io/client/impl/CustomersClient.java index daa9764..1029f6e 100644 --- a/src/main/java/conekta/io/client/impl/CustomersClient.java +++ b/src/main/java/conekta/io/client/impl/CustomersClient.java @@ -2,21 +2,24 @@ import conekta.io.client.ConektaRequestor; import conekta.io.config.Constants; -import conekta.io.config.Headers; -import conekta.io.model.ConektaObject; +import conekta.io.model.impl.Customer; import java.net.http.HttpResponse; public class CustomersClient implements ConektaRequestor { + public HttpResponse createCustomer(Customer customer) { + return ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "POST"); + } + + public HttpResponse getCustomers(Customer customer) { + return ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "GET"); + } - public HttpResponse getCustomerList(ConektaObject conektaObject, Headers headers, String url, String method) { - return ConektaRequestor.super.doRequest(conektaObject, headers, url, method); + public HttpResponse updateCustomer(Customer customer) { + return ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "PUT"); } - public HttpResponse createCustomer(ConektaObject conektaObject, Headers headers, String url, String method) { - return ConektaRequestor.super.doRequest(conektaObject, - headers, - Constants.API_BASE + Constants.CUSTOMERS_PATH, - "POST"); + public HttpResponse deleteCustomer(Customer customer) { + return ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "DELETE"); } } diff --git a/src/main/java/conekta/io/config/Headers.java b/src/main/java/conekta/io/config/Headers.java deleted file mode 100644 index cd9db88..0000000 --- a/src/main/java/conekta/io/config/Headers.java +++ /dev/null @@ -1,29 +0,0 @@ -package conekta.io.config; - - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -public class Headers { - - - - - /** - * - */ - public static final String HEADER_1 = "Accept:application/vnd.conekta-v2.0.0+json"; - - - List headers = new Set<>(); - headers.add("Accept:application/vnd.conekta-v2.0.0+json"); - headers.add("Content-Type:application/json; charset=utf-8"); - - - - - public String getListed() { - return ""; - } -} From f8ec37ad2f9df86133378a9c7e5061460e0ede7c Mon Sep 17 00:00:00 2001 From: Matias Date: Mon, 1 Aug 2022 17:03:19 -0300 Subject: [PATCH 13/24] cleaning code. --- .../conekta/io/client/ConektaRequestor.java | 5 +-- .../io/config/ConektaAuthenticator.java | 2 +- .../java/conekta/io/config/Constants.java | 33 +++++++++++++------ .../io/model/PaginatedConektaObject.java | 1 - 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/main/java/conekta/io/client/ConektaRequestor.java b/src/main/java/conekta/io/client/ConektaRequestor.java index 8be2365..413afba 100644 --- a/src/main/java/conekta/io/client/ConektaRequestor.java +++ b/src/main/java/conekta/io/client/ConektaRequestor.java @@ -1,6 +1,7 @@ package conekta.io.client; import conekta.io.config.ConektaAuthenticator; +import conekta.io.config.Constants; import conekta.io.error.IOConektaRequestorException; import conekta.io.error.InterruptedConektaRequestorException; import conekta.io.model.ConektaObject; @@ -32,8 +33,8 @@ default HttpResponse doRequest(ConektaObject conektaObject, String url, HttpRequest request = HttpRequest.newBuilder() .method(method, HttpRequest.BodyPublishers.ofString(conektaObject.parseToString())) .uri(URI.create(url)) - .setHeader("Content-Type", "application/json; charset=utf-8") - .setHeader("Accept", "application/vnd.conekta-v2.0.0+json") + .setHeader(Constants.CONTENT_TYPE, Constants.APPLICATION_JSON_CHARSET_UTF_8) + .setHeader(Constants.ACCEPT, Constants.APPLICATION_VND_CONEKTA_V_2_0_0_JSON) .build(); return send(request); } diff --git a/src/main/java/conekta/io/config/ConektaAuthenticator.java b/src/main/java/conekta/io/config/ConektaAuthenticator.java index d52074f..5a9858c 100644 --- a/src/main/java/conekta/io/config/ConektaAuthenticator.java +++ b/src/main/java/conekta/io/config/ConektaAuthenticator.java @@ -9,7 +9,7 @@ public class ConektaAuthenticator { private static String username = null; private static String password = null; - private ConektaAuthenticator(){ + private ConektaAuthenticator() { } public static ConektaAuthenticator getInstance() { diff --git a/src/main/java/conekta/io/config/Constants.java b/src/main/java/conekta/io/config/Constants.java index af47823..e8a5a02 100644 --- a/src/main/java/conekta/io/config/Constants.java +++ b/src/main/java/conekta/io/config/Constants.java @@ -3,30 +3,43 @@ public class Constants { /** - * + * The default base URL to use when building requests to the Conekta API. */ public static final String API_BASE = "https://apipp.conekta.io/"; //TODO cambiar a produccion /** - * + * Version of the Conekta API to use. */ - public static final String API_VERSION = "2.0.0"; + public static final String API_VERSION = "2.1.1"; /** - * + * Locale to use when building requests to the Conekta API. */ - public static final String VERSION = "2.1.1"; + public static final String LOCALE = "es"; - /* + /** + * The customer path. */ - public static final String LOCALE = "es"; + public static final String CUSTOMERS_PATH = "customers"; + + /** + * Content type header. + */ + public static final String CONTENT_TYPE = "Content-Type"; /** - * + * Accept header. */ - public static final String CUSTOMERS_PATH = "cutomers"; + public static final String ACCEPT = "Accept"; - + /** + * Content type header value. + */ + public static final String APPLICATION_JSON_CHARSET_UTF_8 = "application/json; charset=utf-8"; + /** + * Accept header value. + */ + public static final String APPLICATION_VND_CONEKTA_V_2_0_0_JSON = "application/vnd.conekta-v2.0.0+json"; } diff --git a/src/main/java/conekta/io/model/PaginatedConektaObject.java b/src/main/java/conekta/io/model/PaginatedConektaObject.java index f43c1ee..2d452dc 100644 --- a/src/main/java/conekta/io/model/PaginatedConektaObject.java +++ b/src/main/java/conekta/io/model/PaginatedConektaObject.java @@ -1,6 +1,5 @@ package conekta.io.model; -import conekta.io.model.ConektaObject; import lombok.Data; import java.util.*; From 644e00e44b2cd28794d6f57bff190906d0acadf5 Mon Sep 17 00:00:00 2001 From: afalla-conekta Date: Tue, 2 Aug 2022 09:01:01 -0500 Subject: [PATCH 14/24] Create customer service --- pom.xml | 161 +++++++++--------- .../conekta/io/client/ConektaRequestor.java | 24 ++- .../io/config/ConektaAuthenticator.java | 4 +- 3 files changed, 101 insertions(+), 88 deletions(-) diff --git a/pom.xml b/pom.xml index 135d8e7..95d0f85 100644 --- a/pom.xml +++ b/pom.xml @@ -1,86 +1,93 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - conekta.io - ct-conekta-java - 1.0-SNAPSHOT + conekta.io + ct-conekta-java + 1.0-SNAPSHOT - ct-conekta-java - This is a java library that allows interaction with https://api.conekta.io API. - https://www.conekta.io + ct-conekta-java + This is a java library that allows interaction with https://api.conekta.io API. + https://www.conekta.io - - UTF-8 - 11 - 11 - + + UTF-8 + 11 + 11 + - - - com.fasterxml.jackson.jr - jackson-jr-objects - 2.13.3 - - - junit - junit - 4.13.2 - test - - - org.projectlombok - lombok - 1.18.24 - provided - - + + + com.fasterxml.jackson.jr + jackson-jr-objects + 2.13.3 + + + junit + junit + 4.13.2 + test + + + org.projectlombok + lombok + 1.18.24 + provided + - - - - - - maven-clean-plugin - 3.1.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.8.0 - - - maven-surefire-plugin - 2.22.1 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - maven-site-plugin - 3.7.1 - - - maven-project-info-reports-plugin - 3.0.0 - - - - + + com.google.code.gson + gson + 2.9.0 + + + + + + + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + + maven-surefire-plugin + 2.22.1 + + + maven-jar-plugin + 3.0.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + maven-site-plugin + 3.7.1 + + + maven-project-info-reports-plugin + 3.0.0 + + + + diff --git a/src/main/java/conekta/io/client/ConektaRequestor.java b/src/main/java/conekta/io/client/ConektaRequestor.java index 413afba..ab04077 100644 --- a/src/main/java/conekta/io/client/ConektaRequestor.java +++ b/src/main/java/conekta/io/client/ConektaRequestor.java @@ -1,5 +1,6 @@ package conekta.io.client; +import com.google.gson.Gson; import conekta.io.config.ConektaAuthenticator; import conekta.io.config.Constants; import conekta.io.error.IOConektaRequestorException; @@ -30,14 +31,19 @@ private HttpResponse send(HttpRequest request) { } default HttpResponse doRequest(ConektaObject conektaObject, String url, String method) { - HttpRequest request = HttpRequest.newBuilder() - .method(method, HttpRequest.BodyPublishers.ofString(conektaObject.parseToString())) - .uri(URI.create(url)) - .setHeader(Constants.CONTENT_TYPE, Constants.APPLICATION_JSON_CHARSET_UTF_8) - .setHeader(Constants.ACCEPT, Constants.APPLICATION_VND_CONEKTA_V_2_0_0_JSON) - .build(); - return send(request); + try { + Gson gson = new Gson(); + String jsonBody = gson.toJson(conektaObject); + HttpRequest request = HttpRequest.newBuilder() + .method(method, HttpRequest.BodyPublishers.ofString(jsonBody)) + .uri(URI.create(url)) + .setHeader(Constants.CONTENT_TYPE, Constants.APPLICATION_JSON_CHARSET_UTF_8) + .setHeader(Constants.ACCEPT, Constants.APPLICATION_VND_CONEKTA_V_2_0_0_JSON) + .build(); + return send(request); + } catch (Exception exp) { + exp.toString(); + } + return null; } - - } diff --git a/src/main/java/conekta/io/config/ConektaAuthenticator.java b/src/main/java/conekta/io/config/ConektaAuthenticator.java index 5a9858c..3de83d1 100644 --- a/src/main/java/conekta/io/config/ConektaAuthenticator.java +++ b/src/main/java/conekta/io/config/ConektaAuthenticator.java @@ -6,8 +6,8 @@ public class ConektaAuthenticator { private static ConektaAuthenticator conektaAuthenticator = null; - private static String username = null; - private static String password = null; + private static String username = "key_7yMxyxV1iNbxyaxPxi5zzQ"; + private static String password = ""; private ConektaAuthenticator() { } From b04f74239f2c93f0b7c6e8e8dc746098975d79c4 Mon Sep 17 00:00:00 2001 From: afalla-conekta Date: Tue, 2 Aug 2022 12:53:04 -0500 Subject: [PATCH 15/24] Ajustes ObjectMapper --- pom.xml | 4 +- .../conekta/io/client/ConektaRequestor.java | 18 +++++++-- .../io/client/impl/CustomersClient.java | 14 +++++++ .../io/config/ConektaObjectMapper.java | 40 +++++++++++++++++++ .../java/conekta/io/model/ConektaObject.java | 4 +- .../io/model/PaginatedConektaObject.java | 7 ++-- .../io/model/submodel/AntifraudInfo.java | 4 +- .../io/model/submodel/PaymentSource.java | 4 ++ .../io/model/submodel/ShippingContact.java | 3 ++ 9 files changed, 86 insertions(+), 12 deletions(-) create mode 100644 src/main/java/conekta/io/config/ConektaObjectMapper.java diff --git a/pom.xml b/pom.xml index 95d0f85..8963413 100644 --- a/pom.xml +++ b/pom.xml @@ -20,8 +20,8 @@ - com.fasterxml.jackson.jr - jackson-jr-objects + com.fasterxml.jackson.core + jackson-databind 2.13.3 diff --git a/src/main/java/conekta/io/client/ConektaRequestor.java b/src/main/java/conekta/io/client/ConektaRequestor.java index ab04077..55eb267 100644 --- a/src/main/java/conekta/io/client/ConektaRequestor.java +++ b/src/main/java/conekta/io/client/ConektaRequestor.java @@ -1,7 +1,7 @@ package conekta.io.client; -import com.google.gson.Gson; import conekta.io.config.ConektaAuthenticator; +import conekta.io.config.ConektaObjectMapper; import conekta.io.config.Constants; import conekta.io.error.IOConektaRequestorException; import conekta.io.error.InterruptedConektaRequestorException; @@ -32,15 +32,25 @@ private HttpResponse send(HttpRequest request) { default HttpResponse doRequest(ConektaObject conektaObject, String url, String method) { try { - Gson gson = new Gson(); - String jsonBody = gson.toJson(conektaObject); + // ObjectMapper objectMapper = new ObjectMapper().setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE); + // objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false).setSerializationInclusion(JsonInclude.Include.NON_NULL); + + String jsonBody = ConektaObjectMapper.getInstance().conektaObjectToString(conektaObject); + + // String jsonBody = objectMapper.writeValueAsString(conektaObject); + HttpRequest request = HttpRequest.newBuilder() .method(method, HttpRequest.BodyPublishers.ofString(jsonBody)) .uri(URI.create(url)) .setHeader(Constants.CONTENT_TYPE, Constants.APPLICATION_JSON_CHARSET_UTF_8) .setHeader(Constants.ACCEPT, Constants.APPLICATION_VND_CONEKTA_V_2_0_0_JSON) .build(); - return send(request); + HttpResponse algo = send(request); + + + return algo; + + } catch (Exception exp) { exp.toString(); } diff --git a/src/main/java/conekta/io/client/impl/CustomersClient.java b/src/main/java/conekta/io/client/impl/CustomersClient.java index 1029f6e..3ff1fab 100644 --- a/src/main/java/conekta/io/client/impl/CustomersClient.java +++ b/src/main/java/conekta/io/client/impl/CustomersClient.java @@ -1,16 +1,30 @@ package conekta.io.client.impl; +import com.fasterxml.jackson.core.JsonProcessingException; import conekta.io.client.ConektaRequestor; +import conekta.io.config.ConektaObjectMapper; import conekta.io.config.Constants; import conekta.io.model.impl.Customer; import java.net.http.HttpResponse; public class CustomersClient implements ConektaRequestor { + + public HttpResponse createCustomer(Customer customer) { return ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "POST"); } + public Customer createCustomer2(Customer customer) throws JsonProcessingException { + + //User user = objectMapper.readValue(JSON, User.class); + HttpResponse cosa = ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "POST"); + + Customer cus = ConektaObjectMapper.getInstance().stringJsonToObject(cosa.body(), Customer.class); + + return cus; + } + public HttpResponse getCustomers(Customer customer) { return ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "GET"); } diff --git a/src/main/java/conekta/io/config/ConektaObjectMapper.java b/src/main/java/conekta/io/config/ConektaObjectMapper.java new file mode 100644 index 0000000..66a52e4 --- /dev/null +++ b/src/main/java/conekta/io/config/ConektaObjectMapper.java @@ -0,0 +1,40 @@ +package conekta.io.config; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import conekta.io.model.ConektaObject; + +public class ConektaObjectMapper { + + private static ConektaObjectMapper conektaObjectMapper = null; + private static ObjectMapper objectMapper = null; + + public static ConektaObjectMapper getInstance() { + if (conektaObjectMapper == null) { + conektaObjectMapper = new ConektaObjectMapper(); + } + return conektaObjectMapper; + } + + private ConektaObjectMapper() { + objectMapper = new ObjectMapper() + .setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE) + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) + .setSerializationInclusion(JsonInclude.Include.NON_NULL); + } + + public String conektaObjectToString(ConektaObject conektaObject) throws JsonProcessingException { + return objectMapper.writeValueAsString(conektaObject); + } + + public ConektaObject stringJsonToConektaObject(String conektaJsonStr) throws JsonProcessingException { + return objectMapper.readValue(conektaJsonStr, ConektaObject.class); + } + + public T stringJsonToObject(String jsonStr, Class valueType) throws JsonProcessingException { + return objectMapper.readValue(jsonStr, valueType); + } +} diff --git a/src/main/java/conekta/io/model/ConektaObject.java b/src/main/java/conekta/io/model/ConektaObject.java index 8068f45..31091f2 100644 --- a/src/main/java/conekta/io/model/ConektaObject.java +++ b/src/main/java/conekta/io/model/ConektaObject.java @@ -1,7 +1,9 @@ package conekta.io.model; -import lombok.Data; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) public abstract class ConektaObject { private String id; diff --git a/src/main/java/conekta/io/model/PaginatedConektaObject.java b/src/main/java/conekta/io/model/PaginatedConektaObject.java index 2d452dc..d81e17e 100644 --- a/src/main/java/conekta/io/model/PaginatedConektaObject.java +++ b/src/main/java/conekta/io/model/PaginatedConektaObject.java @@ -1,12 +1,13 @@ package conekta.io.model; import lombok.Data; -import java.util.*; + +import java.util.List; @Data -public class PaginatedConektaObject { +public class PaginatedConektaObject { - private List data; + private List data; private boolean hasMore; private int total; private String object; diff --git a/src/main/java/conekta/io/model/submodel/AntifraudInfo.java b/src/main/java/conekta/io/model/submodel/AntifraudInfo.java index 6c95b01..ff7035b 100644 --- a/src/main/java/conekta/io/model/submodel/AntifraudInfo.java +++ b/src/main/java/conekta/io/model/submodel/AntifraudInfo.java @@ -4,6 +4,6 @@ @Data public class AntifraudInfo { - Long firstPaidAt; - Long accountCreatedAt; + private Long firstPaidAt; + private Long accountCreatedAt; } diff --git a/src/main/java/conekta/io/model/submodel/PaymentSource.java b/src/main/java/conekta/io/model/submodel/PaymentSource.java index 4e450ed..13b2744 100644 --- a/src/main/java/conekta/io/model/submodel/PaymentSource.java +++ b/src/main/java/conekta/io/model/submodel/PaymentSource.java @@ -1,11 +1,15 @@ package conekta.io.model.submodel; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; import conekta.io.model.ConektaObject; import lombok.Data; @Data +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) public class PaymentSource extends ConektaObject { private String type; + private String tokenId; private Long createdAt; private String last4; private String bin; diff --git a/src/main/java/conekta/io/model/submodel/ShippingContact.java b/src/main/java/conekta/io/model/submodel/ShippingContact.java index 27dcd62..f7802a2 100644 --- a/src/main/java/conekta/io/model/submodel/ShippingContact.java +++ b/src/main/java/conekta/io/model/submodel/ShippingContact.java @@ -1,9 +1,12 @@ package conekta.io.model.submodel; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; import conekta.io.model.ConektaObject; import lombok.Data; @Data +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) public class ShippingContact extends ConektaObject { private String receiver; private String phone; From 5ded18254c559aac0e6b3d8cfb54b3cb6c83d3f3 Mon Sep 17 00:00:00 2001 From: afalla-conekta Date: Tue, 2 Aug 2022 14:03:01 -0500 Subject: [PATCH 16/24] Prueba Obejto customer --- .../conekta/io/client/ConektaRequestor.java | 34 ++++++------------- .../io/client/impl/CustomersClient.java | 16 +++------ .../java/conekta/io/model/impl/Customer.java | 18 ++++++---- .../java/conekta/io/model/impl/Order.java | 3 ++ 4 files changed, 29 insertions(+), 42 deletions(-) diff --git a/src/main/java/conekta/io/client/ConektaRequestor.java b/src/main/java/conekta/io/client/ConektaRequestor.java index 55eb267..8157fbf 100644 --- a/src/main/java/conekta/io/client/ConektaRequestor.java +++ b/src/main/java/conekta/io/client/ConektaRequestor.java @@ -1,5 +1,6 @@ package conekta.io.client; +import com.fasterxml.jackson.core.JsonProcessingException; import conekta.io.config.ConektaAuthenticator; import conekta.io.config.ConektaObjectMapper; import conekta.io.config.Constants; @@ -30,30 +31,15 @@ private HttpResponse send(HttpRequest request) { } } - default HttpResponse doRequest(ConektaObject conektaObject, String url, String method) { - try { - // ObjectMapper objectMapper = new ObjectMapper().setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE); - // objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false).setSerializationInclusion(JsonInclude.Include.NON_NULL); - - String jsonBody = ConektaObjectMapper.getInstance().conektaObjectToString(conektaObject); - - // String jsonBody = objectMapper.writeValueAsString(conektaObject); - - HttpRequest request = HttpRequest.newBuilder() - .method(method, HttpRequest.BodyPublishers.ofString(jsonBody)) - .uri(URI.create(url)) - .setHeader(Constants.CONTENT_TYPE, Constants.APPLICATION_JSON_CHARSET_UTF_8) - .setHeader(Constants.ACCEPT, Constants.APPLICATION_VND_CONEKTA_V_2_0_0_JSON) - .build(); - HttpResponse algo = send(request); + default HttpResponse doRequest(ConektaObject conektaObject, String url, String method) throws JsonProcessingException { - - return algo; - - - } catch (Exception exp) { - exp.toString(); - } - return null; + String jsonBody = ConektaObjectMapper.getInstance().conektaObjectToString(conektaObject); + HttpRequest request = HttpRequest.newBuilder() + .method(method, HttpRequest.BodyPublishers.ofString(jsonBody)) + .uri(URI.create(url)) + .setHeader(Constants.CONTENT_TYPE, Constants.APPLICATION_JSON_CHARSET_UTF_8) + .setHeader(Constants.ACCEPT, Constants.APPLICATION_VND_CONEKTA_V_2_0_0_JSON) + .build(); + return send(request); } } diff --git a/src/main/java/conekta/io/client/impl/CustomersClient.java b/src/main/java/conekta/io/client/impl/CustomersClient.java index 3ff1fab..580151e 100644 --- a/src/main/java/conekta/io/client/impl/CustomersClient.java +++ b/src/main/java/conekta/io/client/impl/CustomersClient.java @@ -11,29 +11,21 @@ public class CustomersClient implements ConektaRequestor { - public HttpResponse createCustomer(Customer customer) { - return ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "POST"); - } - - public Customer createCustomer2(Customer customer) throws JsonProcessingException { - - //User user = objectMapper.readValue(JSON, User.class); + public Customer createCustomer(Customer customer) throws JsonProcessingException { HttpResponse cosa = ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "POST"); - Customer cus = ConektaObjectMapper.getInstance().stringJsonToObject(cosa.body(), Customer.class); - return cus; } - public HttpResponse getCustomers(Customer customer) { + public HttpResponse getCustomers(Customer customer) throws JsonProcessingException { return ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "GET"); } - public HttpResponse updateCustomer(Customer customer) { + public HttpResponse updateCustomer(Customer customer) throws JsonProcessingException { return ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "PUT"); } - public HttpResponse deleteCustomer(Customer customer) { + public HttpResponse deleteCustomer(Customer customer) throws JsonProcessingException { return ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "DELETE"); } } diff --git a/src/main/java/conekta/io/model/impl/Customer.java b/src/main/java/conekta/io/model/impl/Customer.java index b69a420..7397b7c 100644 --- a/src/main/java/conekta/io/model/impl/Customer.java +++ b/src/main/java/conekta/io/model/impl/Customer.java @@ -1,14 +1,13 @@ package conekta.io.model.impl; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; import conekta.io.model.ConektaObject; import conekta.io.model.submodel.AntifraudInfo; -import conekta.io.model.submodel.PaymentSource; -import conekta.io.model.submodel.ShippingContact; import lombok.Data; -import java.util.List; - @Data +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) public class Customer extends ConektaObject { private Boolean livemode; @@ -21,8 +20,15 @@ public class Customer extends ConektaObject { private String customReference; private AntifraudInfo antifraudInfo; private String defaultPaymentSourceId; - private List paymentSources; - private List shippingContacts; + + /* private PaginatedConektaObject paymentSources; + private List lstPaymentSources; + private List lstShippingContacts; + private PaginatedConektaObject shippingContacts; */ + + private Object paymentSources; + private Object shippingContacts; + //TODO REVISAR CON UN EXPERTO } diff --git a/src/main/java/conekta/io/model/impl/Order.java b/src/main/java/conekta/io/model/impl/Order.java index 8868f2d..0d6d7b9 100644 --- a/src/main/java/conekta/io/model/impl/Order.java +++ b/src/main/java/conekta/io/model/impl/Order.java @@ -1,5 +1,7 @@ package conekta.io.model.impl; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; import conekta.io.model.ConektaObject; import conekta.io.model.submodel.*; import lombok.Data; @@ -7,6 +9,7 @@ import java.util.List; @Data +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) public class Order extends ConektaObject { private String createdAt; From 68963f58fedd553108dedf2f36a8bdef8db033e3 Mon Sep 17 00:00:00 2001 From: Matias Date: Tue, 2 Aug 2022 16:45:31 -0300 Subject: [PATCH 17/24] customer methods added --- .../conekta/io/client/ConektaRequestor.java | 10 +-- .../io/client/impl/CustomersClient.java | 82 ++++++++++++++++--- 2 files changed, 74 insertions(+), 18 deletions(-) diff --git a/src/main/java/conekta/io/client/ConektaRequestor.java b/src/main/java/conekta/io/client/ConektaRequestor.java index 8157fbf..6b3c8f1 100644 --- a/src/main/java/conekta/io/client/ConektaRequestor.java +++ b/src/main/java/conekta/io/client/ConektaRequestor.java @@ -17,21 +17,15 @@ public interface ConektaRequestor { - private HttpResponse send(HttpRequest request) { - try { + private HttpResponse send(HttpRequest request) throws IOException, InterruptedException { return HttpClient.newBuilder() .authenticator(ConektaAuthenticator.getBasicAuthenticator()) .connectTimeout(Duration.ofSeconds(15)) .build() .send(request, HttpResponse.BodyHandlers.ofString()); - } catch (IOException e) { - throw new IOConektaRequestorException(e); - } catch (InterruptedException e) { - throw new InterruptedConektaRequestorException(e); - } } - default HttpResponse doRequest(ConektaObject conektaObject, String url, String method) throws JsonProcessingException { + default HttpResponse doRequest(ConektaObject conektaObject, String url, String method) throws IOException, InterruptedException { String jsonBody = ConektaObjectMapper.getInstance().conektaObjectToString(conektaObject); HttpRequest request = HttpRequest.newBuilder() diff --git a/src/main/java/conekta/io/client/impl/CustomersClient.java b/src/main/java/conekta/io/client/impl/CustomersClient.java index 580151e..43f9e19 100644 --- a/src/main/java/conekta/io/client/impl/CustomersClient.java +++ b/src/main/java/conekta/io/client/impl/CustomersClient.java @@ -5,27 +5,89 @@ import conekta.io.config.ConektaObjectMapper; import conekta.io.config.Constants; import conekta.io.model.impl.Customer; +import conekta.io.model.impl.Webhook; +import java.io.IOException; import java.net.http.HttpResponse; +import java.util.Arrays; +import java.util.List; public class CustomersClient implements ConektaRequestor { + /** + * Creates a new customer. + * + * @param customer The customer to be created. + * @return The created customer. + * @throws IOException If an error occurs while communicating with the API. + * @throws InterruptedException If the thread is interrupted while communicating with the API. + */ + public Customer createCustomer(Customer customer) throws IOException, InterruptedException { + HttpResponse customerResponse = ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "POST"); + return ConektaObjectMapper.getInstance().stringJsonToObject(customerResponse.body(), Customer.class); + } + + /** + * Retrieves a customer. + * + * @param customerId The customer's ID. + * @return The customer. + * @throws IOException If an error occurs while communicating with the API. + * @throws InterruptedException If the thread is interrupted while communicating with the API. + */ + public Customer retrieveCustomer(String customerId) throws IOException, InterruptedException { + HttpResponse customerResponse = ConektaRequestor.super.doRequest(null, Constants.API_BASE + Constants.CUSTOMERS_PATH + "/" + customerId, "GET"); + return ConektaObjectMapper.getInstance().stringJsonToObject(customerResponse.body(), Customer.class); + } - public Customer createCustomer(Customer customer) throws JsonProcessingException { - HttpResponse cosa = ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "POST"); - Customer cus = ConektaObjectMapper.getInstance().stringJsonToObject(cosa.body(), Customer.class); - return cus; + /** + * Retrieves all customer. + * + * @return List + * @throws IOException If an error occurs while communicating with the API. + * @throws InterruptedException If the thread is interrupted while communicating with the API. + */ + public List getCustomers() throws IOException, InterruptedException { + HttpResponse customersResponse = ConektaRequestor.super.doRequest(null, Constants.API_BASE + Constants.CUSTOMERS_PATH, "GET"); + return Arrays.asList(ConektaObjectMapper.getInstance().stringJsonToObject(customersResponse.body(), Customer[].class)); } - public HttpResponse getCustomers(Customer customer) throws JsonProcessingException { - return ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "GET"); + /** + * Updates a customer. + * + * @param customer The customer to be updated. + * @return The updated customer. + * @throws IOException If an error occurs while communicating with the API. + * @throws InterruptedException If the thread is interrupted while communicating with the API. + */ + public Customer updateCustomer(Customer customer) throws IOException, InterruptedException { + HttpResponse customerResponse = ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "PUT"); + return ConektaObjectMapper.getInstance().stringJsonToObject(customerResponse.body(), Customer.class); } - public HttpResponse updateCustomer(Customer customer) throws JsonProcessingException { - return ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "PUT"); + /** + * Logically deletes a customer. + * + * @param customerId The customer's ID. + * @return The logically deleted customer. + * @throws IOException If an error occurs while communicating with the API. + * @throws InterruptedException If the thread is interrupted while communicating with the API. + */ + public Customer deleteCustomer(String customerId) throws IOException, InterruptedException { + HttpResponse customerResponse = ConektaRequestor.super.doRequest(null, Constants.API_BASE + Constants.CUSTOMERS_PATH + "/" + customerId, "DELETE"); + return ConektaObjectMapper.getInstance().stringJsonToObject(customerResponse.body(), Customer.class); } - public HttpResponse deleteCustomer(Customer customer) throws JsonProcessingException { - return ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "DELETE"); + /** + * Get customer webhooks. + * + * @param customerId The customer's ID. + * @return List + * @throws IOException If an error occurs while communicating with the API. + * @throws InterruptedException If the thread is interrupted while communicating with the API. + */ + public List getCustomerWebhooks(String customerId) throws IOException, InterruptedException { + HttpResponse customerResponse = ConektaRequestor.super.doRequest(null, Constants.API_BASE + Constants.CUSTOMERS_PATH + "/" + customerId + "/webhooks", "GET"); + return Arrays.asList(ConektaObjectMapper.getInstance().stringJsonToObject(customerResponse.body(), Webhook[].class)); } } From 2882d9fb1e1ec01280667c85347772637bc6da50 Mon Sep 17 00:00:00 2001 From: afalla-conekta Date: Tue, 2 Aug 2022 16:03:11 -0500 Subject: [PATCH 18/24] Ajustes para pegadas --- src/main/java/conekta/io/client/impl/CustomersClient.java | 6 +++--- src/main/java/conekta/io/model/impl/Customer.java | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/conekta/io/client/impl/CustomersClient.java b/src/main/java/conekta/io/client/impl/CustomersClient.java index 43f9e19..a663804 100644 --- a/src/main/java/conekta/io/client/impl/CustomersClient.java +++ b/src/main/java/conekta/io/client/impl/CustomersClient.java @@ -41,7 +41,7 @@ public Customer retrieveCustomer(String customerId) throws IOException, Interrup } /** - * Retrieves all customer. + * Retrieves all customers. * * @return List * @throws IOException If an error occurs while communicating with the API. @@ -60,8 +60,8 @@ public List getCustomers() throws IOException, InterruptedException { * @throws IOException If an error occurs while communicating with the API. * @throws InterruptedException If the thread is interrupted while communicating with the API. */ - public Customer updateCustomer(Customer customer) throws IOException, InterruptedException { - HttpResponse customerResponse = ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "PUT"); + public Customer updateCustomer(String customerId, Customer customer) throws IOException, InterruptedException { + HttpResponse customerResponse = ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH + "/" + customerId , "PUT"); return ConektaObjectMapper.getInstance().stringJsonToObject(customerResponse.body(), Customer.class); } diff --git a/src/main/java/conekta/io/model/impl/Customer.java b/src/main/java/conekta/io/model/impl/Customer.java index 7397b7c..4e0413d 100644 --- a/src/main/java/conekta/io/model/impl/Customer.java +++ b/src/main/java/conekta/io/model/impl/Customer.java @@ -10,6 +10,7 @@ @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) public class Customer extends ConektaObject { + private String id; private Boolean livemode; private String name; private String email; @@ -30,5 +31,5 @@ public class Customer extends ConektaObject { private Object shippingContacts; //TODO REVISAR CON UN EXPERTO - + private Boolean deleted; } From 7575f5fa914b503d91f773fbef679fb2cacde18e Mon Sep 17 00:00:00 2001 From: afalla-conekta Date: Wed, 3 Aug 2022 09:30:14 -0500 Subject: [PATCH 19/24] Test unitario y Modificaciones List --- .../conekta/io/client/ConektaRequestor.java | 6 +- .../io/client/impl/CustomersClient.java | 60 ++++++++++++---- .../io/config/ConektaAuthenticator.java | 3 +- .../io/config/ConektaObjectMapper.java | 7 +- .../java/conekta/io/config/Constants.java | 4 ++ .../java/conekta/io/model/ConektaObject.java | 8 +-- .../io/model/PaginatedConektaObject.java | 6 +- .../java/conekta/io/model/impl/Customer.java | 6 +- .../java/conekta/io/model/impl/Order.java | 5 +- .../java/conekta/io/model/impl/Webhook.java | 14 ++++ .../conekta/io/model/submodel/Address.java | 2 + .../io/model/submodel/AntifraudInfo.java | 2 + .../io/model/submodel/PaymentSource.java | 5 +- .../io/model/submodel/ShippingContact.java | 5 +- src/test/java/conekta/io/AppTest.java | 4 +- src/test/java/conekta/io/CustomerTest.java | 72 +++++++++++++++++++ 16 files changed, 165 insertions(+), 44 deletions(-) create mode 100644 src/test/java/conekta/io/CustomerTest.java diff --git a/src/main/java/conekta/io/client/ConektaRequestor.java b/src/main/java/conekta/io/client/ConektaRequestor.java index 6b3c8f1..5c077fa 100644 --- a/src/main/java/conekta/io/client/ConektaRequestor.java +++ b/src/main/java/conekta/io/client/ConektaRequestor.java @@ -1,11 +1,8 @@ package conekta.io.client; -import com.fasterxml.jackson.core.JsonProcessingException; import conekta.io.config.ConektaAuthenticator; import conekta.io.config.ConektaObjectMapper; import conekta.io.config.Constants; -import conekta.io.error.IOConektaRequestorException; -import conekta.io.error.InterruptedConektaRequestorException; import conekta.io.model.ConektaObject; import java.io.IOException; @@ -18,7 +15,8 @@ public interface ConektaRequestor { private HttpResponse send(HttpRequest request) throws IOException, InterruptedException { - return HttpClient.newBuilder() + ConektaAuthenticator.getInstance(); + return HttpClient.newBuilder() .authenticator(ConektaAuthenticator.getBasicAuthenticator()) .connectTimeout(Duration.ofSeconds(15)) .build() diff --git a/src/main/java/conekta/io/client/impl/CustomersClient.java b/src/main/java/conekta/io/client/impl/CustomersClient.java index a663804..624b29a 100644 --- a/src/main/java/conekta/io/client/impl/CustomersClient.java +++ b/src/main/java/conekta/io/client/impl/CustomersClient.java @@ -1,16 +1,15 @@ package conekta.io.client.impl; -import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; import conekta.io.client.ConektaRequestor; import conekta.io.config.ConektaObjectMapper; import conekta.io.config.Constants; +import conekta.io.model.PaginatedConektaObject; import conekta.io.model.impl.Customer; import conekta.io.model.impl.Webhook; import java.io.IOException; import java.net.http.HttpResponse; -import java.util.Arrays; -import java.util.List; public class CustomersClient implements ConektaRequestor { @@ -19,7 +18,7 @@ public class CustomersClient implements ConektaRequestor { * * @param customer The customer to be created. * @return The created customer. - * @throws IOException If an error occurs while communicating with the API. + * @throws IOException If an error occurs while communicating with the API. * @throws InterruptedException If the thread is interrupted while communicating with the API. */ public Customer createCustomer(Customer customer) throws IOException, InterruptedException { @@ -32,7 +31,7 @@ public Customer createCustomer(Customer customer) throws IOException, Interrupte * * @param customerId The customer's ID. * @return The customer. - * @throws IOException If an error occurs while communicating with the API. + * @throws IOException If an error occurs while communicating with the API. * @throws InterruptedException If the thread is interrupted while communicating with the API. */ public Customer retrieveCustomer(String customerId) throws IOException, InterruptedException { @@ -43,13 +42,28 @@ public Customer retrieveCustomer(String customerId) throws IOException, Interrup /** * Retrieves all customers. * - * @return List - * @throws IOException If an error occurs while communicating with the API. + * @return PaginatedConektaObject + * @throws IOException If an error occurs while communicating with the API. * @throws InterruptedException If the thread is interrupted while communicating with the API. */ - public List getCustomers() throws IOException, InterruptedException { + public PaginatedConektaObject getCustomers() throws IOException, InterruptedException { HttpResponse customersResponse = ConektaRequestor.super.doRequest(null, Constants.API_BASE + Constants.CUSTOMERS_PATH, "GET"); - return Arrays.asList(ConektaObjectMapper.getInstance().stringJsonToObject(customersResponse.body(), Customer[].class)); + return ConektaObjectMapper.getInstance().stringJsonToObject(customersResponse.body(), new TypeReference<>() { + }); + } + + /** + * Retrieves all customers paginated from next. + * + * @param next The next page. + * @return PaginatedConektaObject + * @throws IOException If an error occurs while communicating with the API. + * @throws InterruptedException If the thread is interrupted while communicating with the API. + */ + public PaginatedConektaObject getCustomers(String next) throws IOException, InterruptedException { + HttpResponse customersResponse = ConektaRequestor.super.doRequest(null, Constants.API_BASE + Constants.CUSTOMERS_PATH + "?next=" + next, "GET"); + return ConektaObjectMapper.getInstance().stringJsonToObject(customersResponse.body(), new TypeReference<>() { + }); } /** @@ -57,11 +71,11 @@ public List getCustomers() throws IOException, InterruptedException { * * @param customer The customer to be updated. * @return The updated customer. - * @throws IOException If an error occurs while communicating with the API. + * @throws IOException If an error occurs while communicating with the API. * @throws InterruptedException If the thread is interrupted while communicating with the API. */ public Customer updateCustomer(String customerId, Customer customer) throws IOException, InterruptedException { - HttpResponse customerResponse = ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH + "/" + customerId , "PUT"); + HttpResponse customerResponse = ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH + "/" + customerId, "PUT"); return ConektaObjectMapper.getInstance().stringJsonToObject(customerResponse.body(), Customer.class); } @@ -70,7 +84,7 @@ public Customer updateCustomer(String customerId, Customer customer) throws IOEx * * @param customerId The customer's ID. * @return The logically deleted customer. - * @throws IOException If an error occurs while communicating with the API. + * @throws IOException If an error occurs while communicating with the API. * @throws InterruptedException If the thread is interrupted while communicating with the API. */ public Customer deleteCustomer(String customerId) throws IOException, InterruptedException { @@ -83,11 +97,27 @@ public Customer deleteCustomer(String customerId) throws IOException, Interrupte * * @param customerId The customer's ID. * @return List - * @throws IOException If an error occurs while communicating with the API. + * @throws IOException If an error occurs while communicating with the API. * @throws InterruptedException If the thread is interrupted while communicating with the API. */ - public List getCustomerWebhooks(String customerId) throws IOException, InterruptedException { + public PaginatedConektaObject getCustomerWebhooks(String customerId) throws IOException, InterruptedException { HttpResponse customerResponse = ConektaRequestor.super.doRequest(null, Constants.API_BASE + Constants.CUSTOMERS_PATH + "/" + customerId + "/webhooks", "GET"); - return Arrays.asList(ConektaObjectMapper.getInstance().stringJsonToObject(customerResponse.body(), Webhook[].class)); + return ConektaObjectMapper.getInstance().stringJsonToObject(customerResponse.body(), new TypeReference<>() { + }); + } + + /** + * Get customer webhooks paginated from next. + * + * @param customerId The customer's ID. + * @param next The next page. + * @return List + * @throws IOException If an error occurs while communicating with the API. + * @throws InterruptedException If the thread is interrupted while communicating with the API. + */ + public PaginatedConektaObject getCustomerWebhooks(String customerId, String next) throws IOException, InterruptedException { + HttpResponse customerResponse = ConektaRequestor.super.doRequest(null, Constants.API_BASE + Constants.CUSTOMERS_PATH + "/" + customerId + "/webhooks?next=" + next, "GET"); + return ConektaObjectMapper.getInstance().stringJsonToObject(customerResponse.body(), new TypeReference<>() { + }); } } diff --git a/src/main/java/conekta/io/config/ConektaAuthenticator.java b/src/main/java/conekta/io/config/ConektaAuthenticator.java index 3de83d1..8fea52d 100644 --- a/src/main/java/conekta/io/config/ConektaAuthenticator.java +++ b/src/main/java/conekta/io/config/ConektaAuthenticator.java @@ -12,11 +12,10 @@ public class ConektaAuthenticator { private ConektaAuthenticator() { } - public static ConektaAuthenticator getInstance() { + public static void getInstance() { if (conektaAuthenticator == null) { conektaAuthenticator = new ConektaAuthenticator(); } - return conektaAuthenticator; } public static void setCredentials(String username, String password) { diff --git a/src/main/java/conekta/io/config/ConektaObjectMapper.java b/src/main/java/conekta/io/config/ConektaObjectMapper.java index 66a52e4..6dfee9d 100644 --- a/src/main/java/conekta/io/config/ConektaObjectMapper.java +++ b/src/main/java/conekta/io/config/ConektaObjectMapper.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.PropertyNamingStrategies; @@ -10,7 +11,7 @@ public class ConektaObjectMapper { private static ConektaObjectMapper conektaObjectMapper = null; - private static ObjectMapper objectMapper = null; + private ObjectMapper objectMapper = null; public static ConektaObjectMapper getInstance() { if (conektaObjectMapper == null) { @@ -37,4 +38,8 @@ public ConektaObject stringJsonToConektaObject(String conektaJsonStr) throws Jso public T stringJsonToObject(String jsonStr, Class valueType) throws JsonProcessingException { return objectMapper.readValue(jsonStr, valueType); } + + public T stringJsonToObject(String jsonStr, TypeReference valueType) throws JsonProcessingException { + return objectMapper.readValue(jsonStr, valueType); + } } diff --git a/src/main/java/conekta/io/config/Constants.java b/src/main/java/conekta/io/config/Constants.java index e8a5a02..dd8e8b2 100644 --- a/src/main/java/conekta/io/config/Constants.java +++ b/src/main/java/conekta/io/config/Constants.java @@ -2,6 +2,10 @@ public class Constants { + private Constants() { + throw new IllegalStateException("Utility class"); + } + /** * The default base URL to use when building requests to the Conekta API. */ diff --git a/src/main/java/conekta/io/model/ConektaObject.java b/src/main/java/conekta/io/model/ConektaObject.java index 31091f2..04ff04d 100644 --- a/src/main/java/conekta/io/model/ConektaObject.java +++ b/src/main/java/conekta/io/model/ConektaObject.java @@ -1,15 +1,11 @@ package conekta.io.model; -import com.fasterxml.jackson.databind.PropertyNamingStrategies; -import com.fasterxml.jackson.databind.annotation.JsonNaming; +import lombok.Data; -@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@Data public abstract class ConektaObject { private String id; private String object; - public String parseToString() { - return this.toString(); - } } diff --git a/src/main/java/conekta/io/model/PaginatedConektaObject.java b/src/main/java/conekta/io/model/PaginatedConektaObject.java index d81e17e..8b87a44 100644 --- a/src/main/java/conekta/io/model/PaginatedConektaObject.java +++ b/src/main/java/conekta/io/model/PaginatedConektaObject.java @@ -1,5 +1,7 @@ package conekta.io.model; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import conekta.io.config.CustomNextPageUrl; import lombok.Data; import java.util.List; @@ -7,9 +9,11 @@ @Data public class PaginatedConektaObject { - private List data; + @JsonSerialize(using = CustomNextPageUrl.class) + private String nextPageUrl; private boolean hasMore; private int total; private String object; + private List data; } \ No newline at end of file diff --git a/src/main/java/conekta/io/model/impl/Customer.java b/src/main/java/conekta/io/model/impl/Customer.java index 4e0413d..ede2a00 100644 --- a/src/main/java/conekta/io/model/impl/Customer.java +++ b/src/main/java/conekta/io/model/impl/Customer.java @@ -1,13 +1,12 @@ package conekta.io.model.impl; -import com.fasterxml.jackson.databind.PropertyNamingStrategies; -import com.fasterxml.jackson.databind.annotation.JsonNaming; import conekta.io.model.ConektaObject; import conekta.io.model.submodel.AntifraudInfo; +import lombok.Builder; import lombok.Data; @Data -@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) + public class Customer extends ConektaObject { private String id; @@ -30,6 +29,5 @@ public class Customer extends ConektaObject { private Object paymentSources; private Object shippingContacts; //TODO REVISAR CON UN EXPERTO - private Boolean deleted; } diff --git a/src/main/java/conekta/io/model/impl/Order.java b/src/main/java/conekta/io/model/impl/Order.java index 0d6d7b9..90313d5 100644 --- a/src/main/java/conekta/io/model/impl/Order.java +++ b/src/main/java/conekta/io/model/impl/Order.java @@ -1,15 +1,14 @@ package conekta.io.model.impl; -import com.fasterxml.jackson.databind.PropertyNamingStrategies; -import com.fasterxml.jackson.databind.annotation.JsonNaming; import conekta.io.model.ConektaObject; import conekta.io.model.submodel.*; +import lombok.Builder; import lombok.Data; import java.util.List; @Data -@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) + public class Order extends ConektaObject { private String createdAt; diff --git a/src/main/java/conekta/io/model/impl/Webhook.java b/src/main/java/conekta/io/model/impl/Webhook.java index 56bfc52..90ef64f 100644 --- a/src/main/java/conekta/io/model/impl/Webhook.java +++ b/src/main/java/conekta/io/model/impl/Webhook.java @@ -1,6 +1,20 @@ package conekta.io.model.impl; import conekta.io.model.ConektaObject; +import lombok.Builder; +import lombok.Data; + +import java.util.List; + +@Data public class Webhook extends ConektaObject { + + private String url; + private String status; + private List subscribedEvents; + private Boolean synchronous; + private Boolean productionEnabled; + private Boolean developmentEnabled; + } diff --git a/src/main/java/conekta/io/model/submodel/Address.java b/src/main/java/conekta/io/model/submodel/Address.java index 603a0a3..077eb9c 100644 --- a/src/main/java/conekta/io/model/submodel/Address.java +++ b/src/main/java/conekta/io/model/submodel/Address.java @@ -1,9 +1,11 @@ package conekta.io.model.submodel; import conekta.io.model.ConektaObject; +import lombok.Builder; import lombok.Data; @Data + public class Address extends ConektaObject { private String street1; private String street2; diff --git a/src/main/java/conekta/io/model/submodel/AntifraudInfo.java b/src/main/java/conekta/io/model/submodel/AntifraudInfo.java index ff7035b..559cefc 100644 --- a/src/main/java/conekta/io/model/submodel/AntifraudInfo.java +++ b/src/main/java/conekta/io/model/submodel/AntifraudInfo.java @@ -1,8 +1,10 @@ package conekta.io.model.submodel; +import lombok.Builder; import lombok.Data; @Data + public class AntifraudInfo { private Long firstPaidAt; private Long accountCreatedAt; diff --git a/src/main/java/conekta/io/model/submodel/PaymentSource.java b/src/main/java/conekta/io/model/submodel/PaymentSource.java index 13b2744..c98b12a 100644 --- a/src/main/java/conekta/io/model/submodel/PaymentSource.java +++ b/src/main/java/conekta/io/model/submodel/PaymentSource.java @@ -1,12 +1,11 @@ package conekta.io.model.submodel; -import com.fasterxml.jackson.databind.PropertyNamingStrategies; -import com.fasterxml.jackson.databind.annotation.JsonNaming; import conekta.io.model.ConektaObject; +import lombok.Builder; import lombok.Data; @Data -@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) + public class PaymentSource extends ConektaObject { private String type; private String tokenId; diff --git a/src/main/java/conekta/io/model/submodel/ShippingContact.java b/src/main/java/conekta/io/model/submodel/ShippingContact.java index f7802a2..ffb70d0 100644 --- a/src/main/java/conekta/io/model/submodel/ShippingContact.java +++ b/src/main/java/conekta/io/model/submodel/ShippingContact.java @@ -1,12 +1,11 @@ package conekta.io.model.submodel; -import com.fasterxml.jackson.databind.PropertyNamingStrategies; -import com.fasterxml.jackson.databind.annotation.JsonNaming; import conekta.io.model.ConektaObject; +import lombok.Builder; import lombok.Data; @Data -@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) + public class ShippingContact extends ConektaObject { private String receiver; private String phone; diff --git a/src/test/java/conekta/io/AppTest.java b/src/test/java/conekta/io/AppTest.java index 43d3715..18f665e 100644 --- a/src/test/java/conekta/io/AppTest.java +++ b/src/test/java/conekta/io/AppTest.java @@ -1,9 +1,9 @@ package conekta.io; -import static org.junit.Assert.assertTrue; - import org.junit.Test; +import static org.junit.Assert.assertTrue; + /** * Unit test for simple App. */ diff --git a/src/test/java/conekta/io/CustomerTest.java b/src/test/java/conekta/io/CustomerTest.java new file mode 100644 index 0000000..49dd384 --- /dev/null +++ b/src/test/java/conekta/io/CustomerTest.java @@ -0,0 +1,72 @@ +package conekta.io; + +import conekta.io.client.impl.CustomersClient; +import conekta.io.config.ConektaObjectMapper; +import conekta.io.model.impl.Customer; +import org.junit.Test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +public class CustomerTest { + + CustomersClient customersClient = new CustomersClient(); + + + public CustomerTest() { + super(); + } + + private Customer createMockCustomer() { + Customer cus = new Customer(); + + String customerStr = "{\n" + + " \"name\": \"Andres Falla\",\n" + + " \"email\": \"andres.falla@conekta.com\",\n" + + " \"phone\": \"+5215555555555\",\n" + + " \"corporate\": true,\n" + + " \"antifraud_info\": {\n" + + " \"account_created_at\": 1484040996,\n" + + " \"first_paid_at\": 1485151007\n" + + " },\n" + + " \"payment_sources\": [\n" + + " {\n" + + " \"token_id\": \"tok_test_visa_4242\",\n" + + " \"type\": \"card\"\n" + + " }\n" + + " ],\n" + + " \"shipping_contacts\": [\n" + + " {\n" + + " \"phone\": \"+5215555555555\",\n" + + " \"receiver\": \"Marvin Fuller\",\n" + + " \"between_streets\": \"Morelos Campeche\",\n" + + " \"address\": {\n" + + " \"street1\": \"Nuevo Leon 4\",\n" + + " \"street2\": \"fake street\",\n" + + " \"city\": \"Ciudad de Mexico\",\n" + + " \"state\": \"Ciudad de Mexico\",\n" + + " \"country\": \"MX\",\n" + + " \"postal_code\": \"06100\",\n" + + " \"residential\": true\n" + + " }\n" + + " }\n" + + " ]\n" + + "}}"; + try { + cus = ConektaObjectMapper.getInstance().stringJsonToObject(customerStr, Customer.class); + } catch (Exception e) { + + } + return cus; + } + + @Test + public void testSuccesfulCustomerCreate() throws Exception { + + Customer customerMock = this.createMockCustomer(); + Customer cus = customersClient.createCustomer(customerMock); + + assertTrue(cus instanceof Customer); + assertNotNull(cus.getId()); + } +} From e1e8c2c63d29970e354107eaa1c869090cdfdb8b Mon Sep 17 00:00:00 2001 From: afalla-conekta Date: Wed, 3 Aug 2022 09:36:13 -0500 Subject: [PATCH 20/24] Test Customer --- src/main/java/conekta/io/model/impl/Customer.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/main/java/conekta/io/model/impl/Customer.java b/src/main/java/conekta/io/model/impl/Customer.java index ede2a00..02fc7b2 100644 --- a/src/main/java/conekta/io/model/impl/Customer.java +++ b/src/main/java/conekta/io/model/impl/Customer.java @@ -9,7 +9,6 @@ public class Customer extends ConektaObject { - private String id; private Boolean livemode; private String name; private String email; @@ -20,12 +19,6 @@ public class Customer extends ConektaObject { private String customReference; private AntifraudInfo antifraudInfo; private String defaultPaymentSourceId; - - /* private PaginatedConektaObject paymentSources; - private List lstPaymentSources; - private List lstShippingContacts; - private PaginatedConektaObject shippingContacts; */ - private Object paymentSources; private Object shippingContacts; //TODO REVISAR CON UN EXPERTO From 7be91fbd3b159c99bfe764a8ac3f75ab1f2d940a Mon Sep 17 00:00:00 2001 From: Matias Date: Wed, 3 Aug 2022 14:08:19 -0300 Subject: [PATCH 21/24] refactor and cleanup --- .../conekta/io/client/ConektaRequestor.java | 13 +++++++--- .../io/client/impl/CustomersClient.java | 19 +++++++------- .../io/config/ConektaAuthenticator.java | 4 +-- .../java/conekta/io/config/Constants.java | 26 +++++++++++++++++-- .../conekta/io/config/CustomNextPageUrl.java | 14 ++++++++++ .../java/conekta/io/model/impl/Customer.java | 2 -- 6 files changed, 59 insertions(+), 19 deletions(-) create mode 100644 src/main/java/conekta/io/config/CustomNextPageUrl.java diff --git a/src/main/java/conekta/io/client/ConektaRequestor.java b/src/main/java/conekta/io/client/ConektaRequestor.java index 5c077fa..83c20a0 100644 --- a/src/main/java/conekta/io/client/ConektaRequestor.java +++ b/src/main/java/conekta/io/client/ConektaRequestor.java @@ -12,7 +12,13 @@ import java.net.http.HttpResponse; import java.time.Duration; -public interface ConektaRequestor { +public abstract class ConektaRequestor { + + private String environment = Constants.API_BASE.TEST.getUrl(); + + public void setEnvironment(Constants.API_BASE environment){ + this.environment = environment.getUrl(); + } private HttpResponse send(HttpRequest request) throws IOException, InterruptedException { ConektaAuthenticator.getInstance(); @@ -23,12 +29,11 @@ private HttpResponse send(HttpRequest request) throws IOException, Inter .send(request, HttpResponse.BodyHandlers.ofString()); } - default HttpResponse doRequest(ConektaObject conektaObject, String url, String method) throws IOException, InterruptedException { - + public HttpResponse doRequest(ConektaObject conektaObject, String path, String method) throws IOException, InterruptedException { String jsonBody = ConektaObjectMapper.getInstance().conektaObjectToString(conektaObject); HttpRequest request = HttpRequest.newBuilder() .method(method, HttpRequest.BodyPublishers.ofString(jsonBody)) - .uri(URI.create(url)) + .uri(URI.create(environment + path)) .setHeader(Constants.CONTENT_TYPE, Constants.APPLICATION_JSON_CHARSET_UTF_8) .setHeader(Constants.ACCEPT, Constants.APPLICATION_VND_CONEKTA_V_2_0_0_JSON) .build(); diff --git a/src/main/java/conekta/io/client/impl/CustomersClient.java b/src/main/java/conekta/io/client/impl/CustomersClient.java index 624b29a..2416df2 100644 --- a/src/main/java/conekta/io/client/impl/CustomersClient.java +++ b/src/main/java/conekta/io/client/impl/CustomersClient.java @@ -9,9 +9,10 @@ import conekta.io.model.impl.Webhook; import java.io.IOException; +import java.net.http.HttpRequest; import java.net.http.HttpResponse; -public class CustomersClient implements ConektaRequestor { +public class CustomersClient extends ConektaRequestor { /** * Creates a new customer. @@ -22,7 +23,7 @@ public class CustomersClient implements ConektaRequestor { * @throws InterruptedException If the thread is interrupted while communicating with the API. */ public Customer createCustomer(Customer customer) throws IOException, InterruptedException { - HttpResponse customerResponse = ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH, "POST"); + HttpResponse customerResponse = doRequest(customer, Constants.CUSTOMERS_PATH, Constants.POST); return ConektaObjectMapper.getInstance().stringJsonToObject(customerResponse.body(), Customer.class); } @@ -35,7 +36,7 @@ public Customer createCustomer(Customer customer) throws IOException, Interrupte * @throws InterruptedException If the thread is interrupted while communicating with the API. */ public Customer retrieveCustomer(String customerId) throws IOException, InterruptedException { - HttpResponse customerResponse = ConektaRequestor.super.doRequest(null, Constants.API_BASE + Constants.CUSTOMERS_PATH + "/" + customerId, "GET"); + HttpResponse customerResponse = doRequest(null, Constants.CUSTOMERS_PATH + Constants.SLASH + customerId, Constants.GET); return ConektaObjectMapper.getInstance().stringJsonToObject(customerResponse.body(), Customer.class); } @@ -47,7 +48,7 @@ public Customer retrieveCustomer(String customerId) throws IOException, Interrup * @throws InterruptedException If the thread is interrupted while communicating with the API. */ public PaginatedConektaObject getCustomers() throws IOException, InterruptedException { - HttpResponse customersResponse = ConektaRequestor.super.doRequest(null, Constants.API_BASE + Constants.CUSTOMERS_PATH, "GET"); + HttpResponse customersResponse = doRequest(null, Constants.CUSTOMERS_PATH, Constants.GET); return ConektaObjectMapper.getInstance().stringJsonToObject(customersResponse.body(), new TypeReference<>() { }); } @@ -61,7 +62,7 @@ public PaginatedConektaObject getCustomers() throws IOException, Inter * @throws InterruptedException If the thread is interrupted while communicating with the API. */ public PaginatedConektaObject getCustomers(String next) throws IOException, InterruptedException { - HttpResponse customersResponse = ConektaRequestor.super.doRequest(null, Constants.API_BASE + Constants.CUSTOMERS_PATH + "?next=" + next, "GET"); + HttpResponse customersResponse = doRequest(null, Constants.CUSTOMERS_PATH + Constants.NEXT + next, Constants.GET); return ConektaObjectMapper.getInstance().stringJsonToObject(customersResponse.body(), new TypeReference<>() { }); } @@ -75,7 +76,7 @@ public PaginatedConektaObject getCustomers(String next) throws IOExcep * @throws InterruptedException If the thread is interrupted while communicating with the API. */ public Customer updateCustomer(String customerId, Customer customer) throws IOException, InterruptedException { - HttpResponse customerResponse = ConektaRequestor.super.doRequest(customer, Constants.API_BASE + Constants.CUSTOMERS_PATH + "/" + customerId, "PUT"); + HttpResponse customerResponse = doRequest(customer, Constants.CUSTOMERS_PATH + Constants.SLASH + customerId, Constants.PUT); return ConektaObjectMapper.getInstance().stringJsonToObject(customerResponse.body(), Customer.class); } @@ -88,7 +89,7 @@ public Customer updateCustomer(String customerId, Customer customer) throws IOEx * @throws InterruptedException If the thread is interrupted while communicating with the API. */ public Customer deleteCustomer(String customerId) throws IOException, InterruptedException { - HttpResponse customerResponse = ConektaRequestor.super.doRequest(null, Constants.API_BASE + Constants.CUSTOMERS_PATH + "/" + customerId, "DELETE"); + HttpResponse customerResponse = doRequest(null, Constants.CUSTOMERS_PATH + Constants.SLASH + customerId, Constants.DELETE); return ConektaObjectMapper.getInstance().stringJsonToObject(customerResponse.body(), Customer.class); } @@ -101,7 +102,7 @@ public Customer deleteCustomer(String customerId) throws IOException, Interrupte * @throws InterruptedException If the thread is interrupted while communicating with the API. */ public PaginatedConektaObject getCustomerWebhooks(String customerId) throws IOException, InterruptedException { - HttpResponse customerResponse = ConektaRequestor.super.doRequest(null, Constants.API_BASE + Constants.CUSTOMERS_PATH + "/" + customerId + "/webhooks", "GET"); + HttpResponse customerResponse = doRequest(null, Constants.CUSTOMERS_PATH + Constants.SLASH + customerId + Constants.WEBHOOKS, Constants.GET); return ConektaObjectMapper.getInstance().stringJsonToObject(customerResponse.body(), new TypeReference<>() { }); } @@ -116,7 +117,7 @@ public PaginatedConektaObject getCustomerWebhooks(String customerId) th * @throws InterruptedException If the thread is interrupted while communicating with the API. */ public PaginatedConektaObject getCustomerWebhooks(String customerId, String next) throws IOException, InterruptedException { - HttpResponse customerResponse = ConektaRequestor.super.doRequest(null, Constants.API_BASE + Constants.CUSTOMERS_PATH + "/" + customerId + "/webhooks?next=" + next, "GET"); + HttpResponse customerResponse = doRequest(null, Constants.CUSTOMERS_PATH + Constants.SLASH + customerId + Constants.WEBHOOKS + Constants.NEXT + next, Constants.GET); return ConektaObjectMapper.getInstance().stringJsonToObject(customerResponse.body(), new TypeReference<>() { }); } diff --git a/src/main/java/conekta/io/config/ConektaAuthenticator.java b/src/main/java/conekta/io/config/ConektaAuthenticator.java index 8fea52d..d6638ad 100644 --- a/src/main/java/conekta/io/config/ConektaAuthenticator.java +++ b/src/main/java/conekta/io/config/ConektaAuthenticator.java @@ -6,8 +6,8 @@ public class ConektaAuthenticator { private static ConektaAuthenticator conektaAuthenticator = null; - private static String username = "key_7yMxyxV1iNbxyaxPxi5zzQ"; - private static String password = ""; + private static String username = null; + private static String password = null; private ConektaAuthenticator() { } diff --git a/src/main/java/conekta/io/config/Constants.java b/src/main/java/conekta/io/config/Constants.java index dd8e8b2..c1383ba 100644 --- a/src/main/java/conekta/io/config/Constants.java +++ b/src/main/java/conekta/io/config/Constants.java @@ -2,6 +2,16 @@ public class Constants { + public static final String SLASH = "/"; + public static final String GET = "GET"; + public static final String PUT = "PUT"; + public static final String DELETE = "DELETE"; + public static final String POST = "POST"; + public static final String API_BASE_TEST = "https://apipp.conekta.io/"; + public static final String API_BASE_PROD = "https://api.conekta.io/"; + public static final String NEXT = "?next="; + public static final String WEBHOOKS = "/webhooks"; + private Constants() { throw new IllegalStateException("Utility class"); } @@ -9,8 +19,20 @@ private Constants() { /** * The default base URL to use when building requests to the Conekta API. */ - public static final String API_BASE = "https://apipp.conekta.io/"; - //TODO cambiar a produccion + public enum API_BASE { + LIVE(API_BASE_PROD), + TEST(API_BASE_TEST); + + private final String url; + + API_BASE(String url) { + this.url = url; + } + + public String getUrl() { + return url; + } + } /** * Version of the Conekta API to use. diff --git a/src/main/java/conekta/io/config/CustomNextPageUrl.java b/src/main/java/conekta/io/config/CustomNextPageUrl.java new file mode 100644 index 0000000..a6a138d --- /dev/null +++ b/src/main/java/conekta/io/config/CustomNextPageUrl.java @@ -0,0 +1,14 @@ +package conekta.io.config; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; + +public class CustomNextPageUrl extends JsonSerializer { + @Override + public void serialize(String object, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + jsonGenerator.writeString(object.split("=")[1]); + } +} diff --git a/src/main/java/conekta/io/model/impl/Customer.java b/src/main/java/conekta/io/model/impl/Customer.java index 02fc7b2..1825420 100644 --- a/src/main/java/conekta/io/model/impl/Customer.java +++ b/src/main/java/conekta/io/model/impl/Customer.java @@ -2,11 +2,9 @@ import conekta.io.model.ConektaObject; import conekta.io.model.submodel.AntifraudInfo; -import lombok.Builder; import lombok.Data; @Data - public class Customer extends ConektaObject { private Boolean livemode; From 59cb3c6e1f3f4150ca19ad826b78d0d384227785 Mon Sep 17 00:00:00 2001 From: Matias Date: Thu, 4 Aug 2022 00:44:39 -0300 Subject: [PATCH 22/24] Testing the libraries with httpclient mock server --- pom.xml | 15 +- .../conekta/io/client/ConektaRequestor.java | 33 +++- .../io/client/impl/CustomersClient.java | 1 - .../io/config/ConektaObjectMapper.java | 5 + .../java/conekta/io/config/Constants.java | 1 + src/test/java/conekta/io/AppTest.java | 20 --- src/test/java/conekta/io/CustomerTest.java | 72 --------- src/test/java/conekta/io/Utils.java | 18 +++ .../io/client/impl/CustomersClientTest.java | 152 ++++++++++++++++++ src/test/resources/customer.json | 32 ++++ src/test/resources/customerModified.json | 32 ++++ src/test/resources/webhook.json | 71 ++++++++ 12 files changed, 346 insertions(+), 106 deletions(-) delete mode 100644 src/test/java/conekta/io/AppTest.java delete mode 100644 src/test/java/conekta/io/CustomerTest.java create mode 100644 src/test/java/conekta/io/Utils.java create mode 100644 src/test/java/conekta/io/client/impl/CustomersClientTest.java create mode 100644 src/test/resources/customer.json create mode 100644 src/test/resources/customerModified.json create mode 100644 src/test/resources/webhook.json diff --git a/pom.xml b/pom.xml index 8963413..aede013 100644 --- a/pom.xml +++ b/pom.xml @@ -36,13 +36,18 @@ 1.18.24 provided - - com.google.code.gson - gson - 2.9.0 + org.junit.jupiter + junit-jupiter + 5.9.0 + test + + + com.squareup.okhttp3 + mockwebserver + 4.10.0 + test - diff --git a/src/main/java/conekta/io/client/ConektaRequestor.java b/src/main/java/conekta/io/client/ConektaRequestor.java index 83c20a0..cad22f7 100644 --- a/src/main/java/conekta/io/client/ConektaRequestor.java +++ b/src/main/java/conekta/io/client/ConektaRequestor.java @@ -16,23 +16,40 @@ public abstract class ConektaRequestor { private String environment = Constants.API_BASE.TEST.getUrl(); - public void setEnvironment(Constants.API_BASE environment){ - this.environment = environment.getUrl(); + public void setEnvironment(String environment) { + this.environment = environment; } private HttpResponse send(HttpRequest request) throws IOException, InterruptedException { ConektaAuthenticator.getInstance(); return HttpClient.newBuilder() - .authenticator(ConektaAuthenticator.getBasicAuthenticator()) - .connectTimeout(Duration.ofSeconds(15)) - .build() - .send(request, HttpResponse.BodyHandlers.ofString()); + .authenticator(ConektaAuthenticator.getBasicAuthenticator()) + .connectTimeout(Duration.ofSeconds(Constants.HTTP_CLIENT_TIMEOUT)) + .build() + .send(request, HttpResponse.BodyHandlers.ofString()); } public HttpResponse doRequest(ConektaObject conektaObject, String path, String method) throws IOException, InterruptedException { + HttpRequest.Builder builder = HttpRequest.newBuilder(); String jsonBody = ConektaObjectMapper.getInstance().conektaObjectToString(conektaObject); - HttpRequest request = HttpRequest.newBuilder() - .method(method, HttpRequest.BodyPublishers.ofString(jsonBody)) + switch (method) { + case Constants.POST: + builder = builder.POST(HttpRequest.BodyPublishers.ofString(jsonBody)); + break; + case Constants.GET: + builder = builder.GET(); + break; + case Constants.PUT: + builder = builder.PUT(HttpRequest.BodyPublishers.ofString(jsonBody)); + break; + case Constants.DELETE: + builder = builder.DELETE(); + break; + default: + throw new IllegalArgumentException("Invalid method: " + method); + } + + HttpRequest request = builder .uri(URI.create(environment + path)) .setHeader(Constants.CONTENT_TYPE, Constants.APPLICATION_JSON_CHARSET_UTF_8) .setHeader(Constants.ACCEPT, Constants.APPLICATION_VND_CONEKTA_V_2_0_0_JSON) diff --git a/src/main/java/conekta/io/client/impl/CustomersClient.java b/src/main/java/conekta/io/client/impl/CustomersClient.java index 2416df2..2b7aee4 100644 --- a/src/main/java/conekta/io/client/impl/CustomersClient.java +++ b/src/main/java/conekta/io/client/impl/CustomersClient.java @@ -9,7 +9,6 @@ import conekta.io.model.impl.Webhook; import java.io.IOException; -import java.net.http.HttpRequest; import java.net.http.HttpResponse; public class CustomersClient extends ConektaRequestor { diff --git a/src/main/java/conekta/io/config/ConektaObjectMapper.java b/src/main/java/conekta/io/config/ConektaObjectMapper.java index 6dfee9d..2f1de24 100644 --- a/src/main/java/conekta/io/config/ConektaObjectMapper.java +++ b/src/main/java/conekta/io/config/ConektaObjectMapper.java @@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.PropertyNamingStrategies; import conekta.io.model.ConektaObject; +import conekta.io.model.PaginatedConektaObject; public class ConektaObjectMapper { @@ -31,6 +32,10 @@ public String conektaObjectToString(ConektaObject conektaObject) throws JsonProc return objectMapper.writeValueAsString(conektaObject); } + public String conektaObjectToString(PaginatedConektaObject paginatedConektaObject) throws JsonProcessingException { + return objectMapper.writeValueAsString(paginatedConektaObject); + } + public ConektaObject stringJsonToConektaObject(String conektaJsonStr) throws JsonProcessingException { return objectMapper.readValue(conektaJsonStr, ConektaObject.class); } diff --git a/src/main/java/conekta/io/config/Constants.java b/src/main/java/conekta/io/config/Constants.java index c1383ba..619c7b1 100644 --- a/src/main/java/conekta/io/config/Constants.java +++ b/src/main/java/conekta/io/config/Constants.java @@ -11,6 +11,7 @@ public class Constants { public static final String API_BASE_PROD = "https://api.conekta.io/"; public static final String NEXT = "?next="; public static final String WEBHOOKS = "/webhooks"; + public static final int HTTP_CLIENT_TIMEOUT = 15; private Constants() { throw new IllegalStateException("Utility class"); diff --git a/src/test/java/conekta/io/AppTest.java b/src/test/java/conekta/io/AppTest.java deleted file mode 100644 index 18f665e..0000000 --- a/src/test/java/conekta/io/AppTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package conekta.io; - -import org.junit.Test; - -import static org.junit.Assert.assertTrue; - -/** - * Unit test for simple App. - */ -public class AppTest -{ - /** - * Rigorous Test :-) - */ - @Test - public void shouldAnswerWithTrue() - { - assertTrue( true ); - } -} diff --git a/src/test/java/conekta/io/CustomerTest.java b/src/test/java/conekta/io/CustomerTest.java deleted file mode 100644 index 49dd384..0000000 --- a/src/test/java/conekta/io/CustomerTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package conekta.io; - -import conekta.io.client.impl.CustomersClient; -import conekta.io.config.ConektaObjectMapper; -import conekta.io.model.impl.Customer; -import org.junit.Test; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -public class CustomerTest { - - CustomersClient customersClient = new CustomersClient(); - - - public CustomerTest() { - super(); - } - - private Customer createMockCustomer() { - Customer cus = new Customer(); - - String customerStr = "{\n" + - " \"name\": \"Andres Falla\",\n" + - " \"email\": \"andres.falla@conekta.com\",\n" + - " \"phone\": \"+5215555555555\",\n" + - " \"corporate\": true,\n" + - " \"antifraud_info\": {\n" + - " \"account_created_at\": 1484040996,\n" + - " \"first_paid_at\": 1485151007\n" + - " },\n" + - " \"payment_sources\": [\n" + - " {\n" + - " \"token_id\": \"tok_test_visa_4242\",\n" + - " \"type\": \"card\"\n" + - " }\n" + - " ],\n" + - " \"shipping_contacts\": [\n" + - " {\n" + - " \"phone\": \"+5215555555555\",\n" + - " \"receiver\": \"Marvin Fuller\",\n" + - " \"between_streets\": \"Morelos Campeche\",\n" + - " \"address\": {\n" + - " \"street1\": \"Nuevo Leon 4\",\n" + - " \"street2\": \"fake street\",\n" + - " \"city\": \"Ciudad de Mexico\",\n" + - " \"state\": \"Ciudad de Mexico\",\n" + - " \"country\": \"MX\",\n" + - " \"postal_code\": \"06100\",\n" + - " \"residential\": true\n" + - " }\n" + - " }\n" + - " ]\n" + - "}}"; - try { - cus = ConektaObjectMapper.getInstance().stringJsonToObject(customerStr, Customer.class); - } catch (Exception e) { - - } - return cus; - } - - @Test - public void testSuccesfulCustomerCreate() throws Exception { - - Customer customerMock = this.createMockCustomer(); - Customer cus = customersClient.createCustomer(customerMock); - - assertTrue(cus instanceof Customer); - assertNotNull(cus.getId()); - } -} diff --git a/src/test/java/conekta/io/Utils.java b/src/test/java/conekta/io/Utils.java new file mode 100644 index 0000000..bfcbba2 --- /dev/null +++ b/src/test/java/conekta/io/Utils.java @@ -0,0 +1,18 @@ +package conekta.io; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Paths; + +public class Utils { + public static String readFile(String path, Charset encoding) throws IOException, URISyntaxException { + byte[] encoded = Files.readAllBytes(Paths.get(Utils.class.getClassLoader().getResource(path).toURI())); + return new String(encoded, encoding); + } + + public static String readFile(String path) throws IOException, URISyntaxException { + return readFile(path, Charset.defaultCharset()); + } +} diff --git a/src/test/java/conekta/io/client/impl/CustomersClientTest.java b/src/test/java/conekta/io/client/impl/CustomersClientTest.java new file mode 100644 index 0000000..a958798 --- /dev/null +++ b/src/test/java/conekta/io/client/impl/CustomersClientTest.java @@ -0,0 +1,152 @@ +package conekta.io.client.impl; + +import conekta.io.Utils; +import conekta.io.config.ConektaAuthenticator; +import conekta.io.config.ConektaObjectMapper; +import conekta.io.config.Constants; +import conekta.io.model.PaginatedConektaObject; +import conekta.io.model.impl.Customer; +import conekta.io.model.impl.Webhook; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.util.List; + +class CustomersClientTest { + + private MockWebServer mockWebServer; + private CustomersClient customersClient; + + @BeforeEach + void generateAuthenticator() { + this.mockWebServer = new MockWebServer(); + this.customersClient = new CustomersClient(); + customersClient.setEnvironment(mockWebServer.url("/").toString()); + ConektaAuthenticator.getInstance(); + ConektaAuthenticator.setCredentials("USER", ""); + } + + @Test + void createCustomer() throws URISyntaxException, IOException, InterruptedException { + // Arrange + String customerJson = Utils.readFile("customer.json"); + Customer cus = ConektaObjectMapper.getInstance().stringJsonToObject(customerJson, Customer.class); + mockWebServer.enqueue(new MockResponse() + .addHeader(Constants.CONTENT_TYPE, Constants.APPLICATION_JSON_CHARSET_UTF_8) + .addHeader(Constants.ACCEPT, Constants.APPLICATION_VND_CONEKTA_V_2_0_0_JSON) + .setBody(customerJson) + .setResponseCode(200)); + + // Act + Customer customer = customersClient.createCustomer(cus); + + // Assert + Assertions.assertEquals(customer, cus); + } + + @Test + void retrieveCustomer() throws IOException, URISyntaxException, InterruptedException { + // Arrange + String customerJson = Utils.readFile("customer.json"); + Customer cus = ConektaObjectMapper.getInstance().stringJsonToObject(customerJson, Customer.class); + mockWebServer.enqueue(new MockResponse() + .addHeader(Constants.CONTENT_TYPE, Constants.APPLICATION_JSON_CHARSET_UTF_8) + .addHeader(Constants.ACCEPT, Constants.APPLICATION_VND_CONEKTA_V_2_0_0_JSON) + .setBody(customerJson) + .setResponseCode(200)); + + // Act + Customer customer = customersClient.retrieveCustomer("1"); + + // Assert + Assertions.assertEquals(customer, cus); + } + + @Test + void getCustomers() throws IOException, InterruptedException, URISyntaxException { + String customerJson = Utils.readFile("customer.json"); + Customer cus = ConektaObjectMapper.getInstance().stringJsonToObject(customerJson, Customer.class); + PaginatedConektaObject paginatedConektaObject = new PaginatedConektaObject<>(); + paginatedConektaObject.setData(List.of(cus)); + String s = ConektaObjectMapper.getInstance().conektaObjectToString(paginatedConektaObject); + mockWebServer.enqueue(new MockResponse() + .addHeader(Constants.CONTENT_TYPE, Constants.APPLICATION_JSON_CHARSET_UTF_8) + .addHeader(Constants.ACCEPT, Constants.APPLICATION_VND_CONEKTA_V_2_0_0_JSON) + .setBody(s) + .setResponseCode(200)); + + // Act + PaginatedConektaObject customers = customersClient.getCustomers(); + + // Assert + Assertions.assertEquals(customers.getData().get(0), cus); + } + + @Test + void updateCustomer() throws IOException, InterruptedException, URISyntaxException { + String customerJson = Utils.readFile("customer.json"); + String customerJsonModified = Utils.readFile("customerModified.json"); + Customer cus = ConektaObjectMapper.getInstance().stringJsonToObject(customerJson, Customer.class); + Customer cusModified = ConektaObjectMapper.getInstance().stringJsonToObject(customerJsonModified, Customer.class); + mockWebServer.enqueue(new MockResponse() + .addHeader(Constants.CONTENT_TYPE, Constants.APPLICATION_JSON_CHARSET_UTF_8) + .addHeader(Constants.ACCEPT, Constants.APPLICATION_VND_CONEKTA_V_2_0_0_JSON) + .setBody(customerJsonModified) + .setResponseCode(200)); + + // Act + Customer customer = customersClient.updateCustomer("1", cusModified); + + // Assert + Assertions.assertEquals(customer, cusModified); + Assertions.assertNotEquals(cus, customer); + Assertions.assertNotEquals(cus, cusModified); + + } + + @Test + void deleteCustomer() throws IOException, URISyntaxException, InterruptedException { + // Arrange + String customerJson = Utils.readFile("customer.json"); + Customer cus = ConektaObjectMapper.getInstance().stringJsonToObject(customerJson, Customer.class); + cus.setDeleted(true); + String deletedJson = ConektaObjectMapper.getInstance().conektaObjectToString(cus); + mockWebServer.enqueue(new MockResponse() + .addHeader(Constants.CONTENT_TYPE, Constants.APPLICATION_JSON_CHARSET_UTF_8) + .addHeader(Constants.ACCEPT, Constants.APPLICATION_VND_CONEKTA_V_2_0_0_JSON) + .setBody(deletedJson) + .setResponseCode(200)); + + // Act + Customer customer = customersClient.deleteCustomer("1"); + + // Assert + Assertions.assertEquals(customer, cus); + } + + @Test + void getCustomerWebhooks() throws IOException, URISyntaxException, InterruptedException { + // Arrange + String webhookJson = Utils.readFile("webhook.json"); + Webhook webhook = ConektaObjectMapper.getInstance().stringJsonToObject(webhookJson, Webhook.class); + PaginatedConektaObject paginatedConektaObject = new PaginatedConektaObject<>(); + paginatedConektaObject.setData(List.of(webhook)); + String s = ConektaObjectMapper.getInstance().conektaObjectToString(paginatedConektaObject); + mockWebServer.enqueue(new MockResponse() + .addHeader(Constants.CONTENT_TYPE, Constants.APPLICATION_JSON_CHARSET_UTF_8) + .addHeader(Constants.ACCEPT, Constants.APPLICATION_VND_CONEKTA_V_2_0_0_JSON) + .setBody(s) + .setResponseCode(200)); + + // Act + PaginatedConektaObject webhooks = customersClient.getCustomerWebhooks("1"); + + // Assert + Assertions.assertEquals(webhooks, paginatedConektaObject); + } +} \ No newline at end of file diff --git a/src/test/resources/customer.json b/src/test/resources/customer.json new file mode 100644 index 0000000..63edab6 --- /dev/null +++ b/src/test/resources/customer.json @@ -0,0 +1,32 @@ +{ + "name": "Andres Falla", + "email": "andres.falla@conekta.com", + "phone": "+5215555555555", + "corporate": true, + "antifraud_info": { + "account_created_at": 1484040996, + "first_paid_at": 1485151007 + }, + "payment_sources": [ + { + "token_id": "tok_test_visa_4242", + "type": "card" + } + ], + "shipping_contacts": [ + { + "phone": "+5215555555555", + "receiver": "Marvin Fuller", + "between_streets": "Morelos Campeche", + "address": { + "street1": "Nuevo Leon 4", + "street2": "fake street", + "city": "Ciudad de Mexico", + "state": "Ciudad de Mexico", + "country": "MX", + "postal_code": "06100", + "residential": true + } + } + ] +} \ No newline at end of file diff --git a/src/test/resources/customerModified.json b/src/test/resources/customerModified.json new file mode 100644 index 0000000..0f0032f --- /dev/null +++ b/src/test/resources/customerModified.json @@ -0,0 +1,32 @@ +{ + "name": "Andres Falla", + "email": "andres.falla@conekta.com", + "phone": "+52144444444", + "corporate": true, + "antifraud_info": { + "account_created_at": 1484040996, + "first_paid_at": 1485151007 + }, + "payment_sources": [ + { + "token_id": "tok_test_visa_4242", + "type": "card" + } + ], + "shipping_contacts": [ + { + "phone": "+5215555555555", + "receiver": "Marvin Fuller", + "between_streets": "Morelos Campeche", + "address": { + "street1": "Nuevo Leon 4", + "street2": "fake street", + "city": "Ciudad de Mexico", + "state": "Ciudad de Mexico", + "country": "MX", + "postal_code": "06100", + "residential": true + } + } + ] +} \ No newline at end of file diff --git a/src/test/resources/webhook.json b/src/test/resources/webhook.json new file mode 100644 index 0000000..888ab69 --- /dev/null +++ b/src/test/resources/webhook.json @@ -0,0 +1,71 @@ +{ + "url": "https://shop-plugin.sb.conekta.io/api/webhooks", + "status": "listening", + "subscribed_events": [ + "charge.created", + "charge.paid", + "charge.under_fraud_review", + "charge.fraudulent", + "charge.refunded", + "charge.preauthorized", + "charge.declined", + "charge.canceled", + "charge.reversed", + "charge.pending_confirmation", + "charge.expired", + "customer.created", + "customer.updated", + "customer.deleted", + "webhook.created", + "webhook.updated", + "webhook.deleted", + "charge.chargeback.created", + "charge.chargeback.updated", + "charge.chargeback.under_review", + "charge.chargeback.lost", + "charge.chargeback.won", + "payout.created", + "payout.retrying", + "payout.paid_out", + "payout.failed", + "plan.created", + "plan.updated", + "plan.deleted", + "subscription.created", + "subscription.paused", + "subscription.resumed", + "subscription.canceled", + "subscription.expired", + "subscription.updated", + "subscription.paid", + "subscription.payment_failed", + "payee.created", + "payee.updated", + "payee.deleted", + "payee.payout_method.created", + "payee.payout_method.updated", + "payee.payout_method.deleted", + "charge.score_updated", + "receipt.created", + "order.canceled", + "order.charged_back", + "order.created", + "order.expired", + "order.fraudulent", + "order.under_fraud_review", + "order.paid", + "order.partially_refunded", + "order.pending_payment", + "order.pre_authorized", + "order.refunded", + "order.updated", + "order.voided", + "order.declined", + "webhook_ping" + ], + "synchronous": false, + "id": "62c715e29e9c317f0e49f99f", + "object": "webhook", + "production_enabled": false, + "development_enabled": true +} \ No newline at end of file From 1fc51287949a1b515482ac8c1484aa74ad8dd3c4 Mon Sep 17 00:00:00 2001 From: afalla-conekta Date: Thu, 4 Aug 2022 09:02:53 -0500 Subject: [PATCH 23/24] Ajustes comentarios PR --- src/test/resources/customer.json | 4 ++-- src/test/resources/customerModified.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/resources/customer.json b/src/test/resources/customer.json index 63edab6..f38a751 100644 --- a/src/test/resources/customer.json +++ b/src/test/resources/customer.json @@ -1,6 +1,6 @@ { - "name": "Andres Falla", - "email": "andres.falla@conekta.com", + "name": "Jhon Doe", + "email": "test@test.com", "phone": "+5215555555555", "corporate": true, "antifraud_info": { diff --git a/src/test/resources/customerModified.json b/src/test/resources/customerModified.json index 0f0032f..a36d399 100644 --- a/src/test/resources/customerModified.json +++ b/src/test/resources/customerModified.json @@ -1,6 +1,6 @@ { - "name": "Andres Falla", - "email": "andres.falla@conekta.com", + "name": "Jhon Doe", + "email": "test@ctest.com", "phone": "+52144444444", "corporate": true, "antifraud_info": { From 8f164d38999b938ae399775269733dd5c4d8ed31 Mon Sep 17 00:00:00 2001 From: afalla-conekta Date: Thu, 4 Aug 2022 10:39:05 -0500 Subject: [PATCH 24/24] Ajustes comentarios PR2 --- .gitignore | 132 ++--------------------------------------------------- pom.xml | 2 +- 2 files changed, 4 insertions(+), 130 deletions(-) diff --git a/.gitignore b/.gitignore index 13236bb..deaa03b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,113 +6,32 @@ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# AWS User-specific -.idea/**/aws.xml - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/artifacts -# .idea/compiler.xml -# .idea/jarRepositories.xml -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr +/.idea/ +.vscode/ # CMake cmake-build-*/ -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - -# File-based project format -*.iws - # IntelliJ out/ -# mpeltonen/sbt-idea plugin -.idea_modules/ - # JIRA plugin atlassian-ide-plugin.xml -# Cursive Clojure plugin -.idea/replstate.xml - -# SonarLint plugin -.idea/sonarlint/ - # Crashlytics plugin (for Android Studio and IntelliJ) com_crashlytics_export_strings.xml crashlytics.properties crashlytics-build.properties fabric.properties -# Editor-based Rest Client -.idea/httpRequests - -# Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser ### Intellij Patch ### # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 # *.iml # modules.xml -# .idea/misc.xml # *.ipr -# Sonarlint plugin -# https://plugins.jetbrains.com/plugin/7973-sonarlint -.idea/**/sonarlint/ - -# SonarQube Plugin -# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin -.idea/**/sonarIssues.xml - -# Markdown Navigator plugin -# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced -.idea/**/markdown-navigator.xml -.idea/**/markdown-navigator-enh.xml -.idea/**/markdown-navigator/ - -# Cache file creation bug -# See https://youtrack.jetbrains.com/issue/JBR-2257 -.idea/$CACHE_FILE$ - -# CodeStream plugin -# https://plugins.jetbrains.com/plugin/12206-codestream -.idea/codestream.xml - -# Azure Toolkit for IntelliJ plugin -# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij -.idea/**/azureSettings.xml ### Intellij+all ### # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider @@ -126,20 +45,7 @@ fabric.properties # Sensitive or high-churn files -# Gradle - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/artifacts -# .idea/compiler.xml -# .idea/jarRepositories.xml -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr + # CMake @@ -163,15 +69,6 @@ fabric.properties # Android studio 3.1+ serialized cache file -### Intellij+all Patch ### -# Ignore everything but code style settings and run configurations -# that are supposed to be shared within teams. - -.idea/* - -!.idea/codeStyles -!.idea/runConfigurations - ### Intellij+iml ### # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 @@ -184,20 +81,6 @@ fabric.properties # Sensitive or high-churn files -# Gradle - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/artifacts -# .idea/compiler.xml -# .idea/jarRepositories.xml -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr # CMake @@ -226,7 +109,6 @@ fabric.properties *.iml modules.xml -.idea/misc.xml *.ipr ### Java ### @@ -274,14 +156,6 @@ buildNumber.properties # JDT-specific (Eclipse Java Development Tools) .classpath -### VisualStudioCode ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -!.vscode/*.code-snippets - # Local History for Visual Studio Code .history/ diff --git a/pom.xml b/pom.xml index aede013..2f7cd6f 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ ct-conekta-java This is a java library that allows interaction with https://api.conekta.io API. - https://www.conekta.io + https://www.conekta.com UTF-8