Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPL-222 Publicacion de nuevo SDK en Maven Central #27

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 93 additions & 50 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>conekta.io</groupId>
<groupId>io.conekta</groupId>
<artifactId>ct-conekta-java</artifactId>
<version>1.0-SNAPSHOT</version>
<version>3.0.0</version>

<name>ct-conekta-java</name>
<description>This is a java library that allows interaction with https://api.conekta.io API.</description>
<url>https://www.conekta.com</url>
<url>https://developers.conekta.com/</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

<licenses>
<license>
<name>MIT License</name>
<url>https://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>

<developers>
<developer>
<name>Conekta API Core Team</name>
<email>core@conekta.io</email>
<organization>Conekta, Inc.</organization>
<organizationUrl>https://www.conekta.io</organizationUrl>
</developer>
</developers>

<scm>
<connection>scm:git:git@github.com:conekta/ct-conekta-java.git</connection>
<developerConnection>scm:git:git@github.com:conekta/ct-conekta-java.git</developerConnection>
<url>https://github.com/conekta/ct-conekta-java/tree/master</url>
<tag>HEAD</tag>
</scm>

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.3</version>
<version>2.13.4</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand All @@ -49,50 +73,69 @@
<scope>test</scope>
</dependency>
</dependencies>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<keyname>0xD8F4E014</keyname>
<passphraseServerId>0xD8F4E014</passphraseServerId>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</project>
</project>
21 changes: 13 additions & 8 deletions src/main/java/conekta/io/client/impl/CustomersClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Customer>.
* @param customerReq the customer to be created.
* @return The created customer.
*/
public ConektaResponse<Customer> createCustomer(CustomerReq customerReq) {
HttpResponse<String> customerResponse = doRequest(customerReq, Constants.CUSTOMERS_PATH, Constants.POST);
Expand All @@ -36,7 +36,7 @@ public ConektaResponse<Customer> createCustomer(CustomerReq customerReq) {
* Retrieves a customer in Conekta.
*
* @param customerId The id of the customer to be retrieved.
* @return The retrieved ConektaResponse<Customer>.
* @return The retrieved customer.
*/
public ConektaResponse<Customer> retrieveCustomer(String customerId) {
HttpResponse<String> customerResponse = doRequest(null, Constants.CUSTOMERS_PATH + Constants.SLASH + customerId, Constants.GET);
Expand All @@ -54,7 +54,7 @@ public ConektaResponse<Customer> 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<PaginatedConektaObject<Customer>>.
* @return The retrieved paginated object of customers.
*/
public ConektaResponse<PaginatedConektaObject<Customer>> getCustomers(String next) {
HttpResponse<String> customersResponse = doRequest(null, Constants.CUSTOMERS_PATH + (next != null ? Constants.NEXT + next : ""), Constants.GET);
Expand All @@ -71,7 +71,8 @@ public ConektaResponse<PaginatedConektaObject<Customer>> getCustomers(String nex
* Updates a customer in Conekta.
*
* @param customer The customer to be updated.
* @return The updated ConektaResponse<Customer>.
* @param customerId The id of the customer to be updated.
* @return The updated customer.
*/
public ConektaResponse<Customer> updateCustomer(String customerId, Customer customer) {
HttpResponse<String> customerResponse = doRequest(customer, Constants.CUSTOMERS_PATH + Constants.SLASH + customerId, Constants.PUT);
Expand All @@ -87,7 +88,7 @@ public ConektaResponse<Customer> 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<Customer>.
* @return The deleted customer with deleted == true.
*/
public ConektaResponse<Customer> deleteCustomer(String customerId) {
HttpResponse<String> customerResponse = doRequest(null, Constants.CUSTOMERS_PATH + Constants.SLASH + customerId, Constants.DELETE);
Expand All @@ -103,7 +104,10 @@ public ConektaResponse<Customer> deleteCustomer(String customerId) {
* Retrieves all subscriptions events of a customer in Conekta.
*
* @param customerId The id of the customer to be retrieved.
* @return ConektaResponse<PaginatedConektaObject < Subscription>>.
* @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<PaginatedConektaObject<Event>> getCustomerEvents(String customerId, String next) {
HttpResponse<String> customerResponse = doRequest(null, Constants.CUSTOMERS_PATH + Constants.SLASH + customerId + Constants.EVENTS_PATH + (next != null ? Constants.NEXT + next : ""), Constants.GET);
Expand All @@ -120,7 +124,8 @@ public ConektaResponse<PaginatedConektaObject<Event>> getCustomerEvents(String c
* Retrieves all payments sources of a customer in Conekta.
*
* @param customerId The id of the customer to be retrieved.
* @return ConektaResponse<PaginatedConektaObject < PaymentSource>>.
* @param next The next page of the payments sources to be retrieved
* @return The retrieved paginated object of payments sources.
*/
public ConektaResponse<PaginatedConektaObject<PaymentSource>> getCustomerPaymentSources(String customerId, String next) {
HttpResponse<String> customerResponse = doRequest(null, Constants.CUSTOMERS_PATH + Constants.SLASH + customerId + Constants.PAYMENT_SOURCES + (next != null ? Constants.NEXT + next : ""), Constants.GET);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/conekta/io/config/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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 = "3.0.0";

/**
* Locale to use when building requests to the Conekta API.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/conekta/io/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 : "");
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/conekta/io/OrdersClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand Down