From 735e3d11decd7a09d733fb81cf9f9e1c85928c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Rosemberg?= Date: Wed, 14 Sep 2022 18:59:47 -0300 Subject: [PATCH] Deployment setting up and configuration corrections --- pom.xml | 139 ++++++++++++------ .../conekta/io/client/ConektaRequestor.java | 2 +- .../io/client/impl/CustomersClient.java | 21 ++- .../java/conekta/io/config/Constants.java | 4 +- src/main/java/conekta/io/utils/Utils.java | 4 +- .../java/conekta/io/OrdersClientTest.java | 6 +- 6 files changed, 112 insertions(+), 64 deletions(-) diff --git a/pom.xml b/pom.xml index 2f7cd6f..8acba64 100644 --- a/pom.xml +++ b/pom.xml @@ -1,16 +1,17 @@ - 4.0.0 - conekta.io + io.conekta ct-conekta-java - 1.0-SNAPSHOT + 0.0.8 ct-conekta-java This is a java library that allows interaction with https://api.conekta.io API. - https://www.conekta.com + https://developers.conekta.com/ UTF-8 @@ -18,6 +19,29 @@ 11 + + + MIT License + http://www.opensource.org/licenses/mit-license.php + + + + + + Conekta API Core Team + core@conekta.io + Conekta, Inc. + https://www.conekta.io + + + + + scm:git:git@github.com:conekta/ct-conekta-java.git + scm:git:git@github.com:conekta/ct-conekta-java.git + https://github.com/conekta/ct-conekta-java/tree/master + HEAD + + com.fasterxml.jackson.core @@ -49,50 +73,69 @@ test - + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + - - - - - 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 - - - + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.4.1 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.0.1 + + + sign-artifacts + verify + + sign + + + 0xD8F4E014 + 0xD8F4E014 + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.13 + true + + ossrh + https://oss.sonatype.org/ + true + + + diff --git a/src/main/java/conekta/io/client/ConektaRequestor.java b/src/main/java/conekta/io/client/ConektaRequestor.java index cf6f61c..30f427c 100644 --- a/src/main/java/conekta/io/client/ConektaRequestor.java +++ b/src/main/java/conekta/io/client/ConektaRequestor.java @@ -62,7 +62,7 @@ public HttpResponse doRequest(ConektaObject conektaObject, String path, .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) - .setHeader(Constants.USER_AGENT, Constants.LIB_NAME + Constants.SLASH + Constants.LIB_VERSION) + .setHeader(Constants.USER_AGENT, Constants.LIB_NAME + Constants.SLASH + getClass().getPackage().getImplementationVersion()) .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 0da78da..66c56fd 100644 --- a/src/main/java/conekta/io/client/impl/CustomersClient.java +++ b/src/main/java/conekta/io/client/impl/CustomersClient.java @@ -19,8 +19,8 @@ public class CustomersClient extends ConektaRequestor { /** * Creates a new customer in Conekta. * - * @param customer The customer to be created. - * @return The created ConektaResponse. + * @param customerReq the customer to be created. + * @return The created customer. */ public ConektaResponse createCustomer(CustomerReq customerReq) { HttpResponse customerResponse = doRequest(customerReq, Constants.CUSTOMERS_PATH, Constants.POST); @@ -36,7 +36,7 @@ public ConektaResponse createCustomer(CustomerReq customerReq) { * Retrieves a customer in Conekta. * * @param customerId The id of the customer to be retrieved. - * @return The retrieved ConektaResponse. + * @return The retrieved customer. */ public ConektaResponse retrieveCustomer(String customerId) { HttpResponse customerResponse = doRequest(null, Constants.CUSTOMERS_PATH + Constants.SLASH + customerId, Constants.GET); @@ -54,7 +54,7 @@ public ConektaResponse retrieveCustomer(String customerId) { * @param next The next page of the customers to be retrieved. * If null, the first page will be retrieved. * If not null, the next page will be retrieved. - * @return The retrieved ConektaResponse>. + * @return The retrieved paginated object of customers. */ public ConektaResponse> getCustomers(String next) { HttpResponse customersResponse = doRequest(null, Constants.CUSTOMERS_PATH + (next != null ? Constants.NEXT + next : ""), Constants.GET); @@ -71,7 +71,8 @@ public ConektaResponse> getCustomers(String nex * Updates a customer in Conekta. * * @param customer The customer to be updated. - * @return The updated ConektaResponse. + * @param customerId The id of the customer to be updated. + * @return The updated customer. */ public ConektaResponse updateCustomer(String customerId, Customer customer) { HttpResponse customerResponse = doRequest(customer, Constants.CUSTOMERS_PATH + Constants.SLASH + customerId, Constants.PUT); @@ -87,7 +88,7 @@ public ConektaResponse updateCustomer(String customerId, Customer cust * Deletes a customer in Conekta (Logically). * * @param customerId The id of the customer to be deleted. - * @return The deleted ConektaResponse. + * @return The deleted customer with deleted == true. */ public ConektaResponse deleteCustomer(String customerId) { HttpResponse customerResponse = doRequest(null, Constants.CUSTOMERS_PATH + Constants.SLASH + customerId, Constants.DELETE); @@ -103,7 +104,10 @@ public ConektaResponse deleteCustomer(String customerId) { * Retrieves all subscriptions events of a customer in Conekta. * * @param customerId The id of the customer to be retrieved. - * @return ConektaResponse>. + * @param next The next page of the subscriptions events to be retrieved + * If null, the first page will be retrieved. + * If not null, the next page will be retrieved. + * @return The retrieved paginated object of subscriptions events. */ public ConektaResponse> getCustomerEvents(String customerId, String next) { HttpResponse customerResponse = doRequest(null, Constants.CUSTOMERS_PATH + Constants.SLASH + customerId + Constants.EVENTS_PATH + (next != null ? Constants.NEXT + next : ""), Constants.GET); @@ -120,7 +124,8 @@ public ConektaResponse> getCustomerEvents(String c * Retrieves all payments sources of a customer in Conekta. * * @param customerId The id of the customer to be retrieved. - * @return ConektaResponse>. + * @param next The next page of the payments sources to be retrieved + * @return The retrieved paginated object of payments sources. */ public ConektaResponse> getCustomerPaymentSources(String customerId, String next) { HttpResponse customerResponse = doRequest(null, Constants.CUSTOMERS_PATH + Constants.SLASH + customerId + Constants.PAYMENT_SOURCES + (next != null ? Constants.NEXT + next : ""), Constants.GET); diff --git a/src/main/java/conekta/io/config/Constants.java b/src/main/java/conekta/io/config/Constants.java index 589ef62..20bfd6e 100644 --- a/src/main/java/conekta/io/config/Constants.java +++ b/src/main/java/conekta/io/config/Constants.java @@ -7,7 +7,7 @@ public class Constants { 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_TEST = "https://api-core.stg.conekta.io/"; public static final String API_BASE_PROD = "https://api.conekta.io/"; public static final String NEXT = "?next="; public static final String EVENTS_PATH = "/events"; @@ -45,7 +45,7 @@ public String getUrl() { /** * Version of the lib to use. */ - public static final String LIB_VERSION = "0.0.7"; + public static final String LIB_VERSION = "0.0.8"; /** * Locale to use when building requests to the Conekta API. diff --git a/src/main/java/conekta/io/utils/Utils.java b/src/main/java/conekta/io/utils/Utils.java index 3276c41..71536b0 100644 --- a/src/main/java/conekta/io/utils/Utils.java +++ b/src/main/java/conekta/io/utils/Utils.java @@ -5,8 +5,8 @@ public class Utils { /** * Abbreviate an validate de param "next" for the pagination * - * @param next - * @return + * @param next The next page of the customers to be retrieved. + * @return The next page of the customers to be retrieved. */ public static String nextPage(String next) { return (next != null ? next : ""); diff --git a/src/test/java/conekta/io/OrdersClientTest.java b/src/test/java/conekta/io/OrdersClientTest.java index df236b4..4661990 100644 --- a/src/test/java/conekta/io/OrdersClientTest.java +++ b/src/test/java/conekta/io/OrdersClientTest.java @@ -153,8 +153,8 @@ void getChargesOrderFail() throws IOException, URISyntaxException { @Test void getChargeOrder() throws IOException, URISyntaxException { // Arrange - String orderChargeResponse = Utils.readFile("Orders/orderChargeResponse.json"); - String orderCharge = Utils.readFile("Orders/orderCharge.json"); + String orderChargeResponse = Utils.readFile("orders/orderChargeResponse.json"); + String orderCharge = Utils.readFile("orders/orderCharge.json"); Charge charge = ConektaObjectMapper.getInstance().stringJsonToObject(orderCharge, Charge.class); @@ -171,7 +171,7 @@ void getChargeOrder() throws IOException, URISyntaxException { @Test void getChargeOrderFail() throws IOException, URISyntaxException { // Arrange - String orderChargeFailResponse = Utils.readFile("Orders/orderChargeFailResponse.json"); + String orderChargeFailResponse = Utils.readFile("orders/orderChargeFailResponse.json"); ConektaError orderResp = ConektaObjectMapper.getInstance().stringJsonToObject(orderChargeFailResponse, ConektaError.class); Utils.buildMockServer(this.mockWebServer, orderChargeFailResponse, 404);