Skip to content

Commit

Permalink
Merge pull request #28 from conekta/deployment-features
Browse files Browse the repository at this point in the history
Deployment setting up and configuration corrections
  • Loading branch information
matiasrosemberg authored Sep 14, 2022
2 parents 796306b + ce9b07e commit 732b4ed
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 37 deletions.
44 changes: 23 additions & 21 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<?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>0.0.8</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>
Expand All @@ -24,6 +25,7 @@
<url>http://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>

<developers>
<developer>
<name>Conekta API Core Team</name>
Expand All @@ -32,22 +34,13 @@
<organizationUrl>https://www.conekta.io</organizationUrl>
</developer>
</developers>

<scm>
<connection>scm:git:[email protected]:conekta/ct-conekta-java.git</connection>
<developerConnection>scm:git:[email protected]:conekta/ct-conekta-java.git</developerConnection>
<url>https://github.com/conekta/ct-conekta-java/tree/master</url>
<tag>HEAD</tag>
</scm>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<dependencies>
<dependency>
Expand Down Expand Up @@ -80,13 +73,18 @@
<scope>test</scope>
</dependency>
</dependencies>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -99,7 +97,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<version>3.4.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -112,28 +110,32 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<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.7</version>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</project>
</project>
2 changes: 1 addition & 1 deletion src/main/java/conekta/io/client/ConektaRequestor.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public HttpResponse<String> 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);
}
Expand Down
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 = "0.0.8";

/**
* 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

0 comments on commit 732b4ed

Please sign in to comment.