com.conekta.ChargesApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ct-conekta-java Show documentation
Show all versions of ct-conekta-java Show documentation
This is a java library that allows interaction with https://api.conekta.io API.
The newest version!
package com.conekta;
import com.conekta.ApiException;
import com.conekta.ApiClient;
import com.conekta.ApiResponse;
import com.conekta.Configuration;
import com.conekta.Pair;
import javax.ws.rs.core.GenericType;
import com.conekta.model.ChargeOrderResponse;
import com.conekta.model.ChargeRequest;
import com.conekta.model.ChargeResponse;
import com.conekta.model.ChargeUpdateRequest;
import com.conekta.model.Error;
import com.conekta.model.GetChargesResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0")
public class ChargesApi {
private ApiClient apiClient;
public ChargesApi() {
this(Configuration.getDefaultApiClient());
}
public ChargesApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Get the API client
*
* @return API client
*/
public ApiClient getApiClient() {
return apiClient;
}
/**
* Set the API client
*
* @param apiClient an instance of API client
*/
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Get A List of Charges
*
* @param acceptLanguage Use for knowing which language to use (optional, default to es)
* @param xChildCompanyId In the case of a holding company, the company id of the child company to which will process the request. (optional)
* @param limit The numbers of items to return, the maximum value is 250 (optional, default to 20)
* @param search General order search, e.g. by mail, reference etc. (optional)
* @param next next page (optional)
* @param previous previous page (optional)
* @return GetChargesResponse
* @throws ApiException if fails to make API call
* @http.response.details
Status Code Description Response Headers
200 successful * Date - The date and time that the response was sent
* Content-Type - The format of the response body
* Content-Length - The length of the response body in bytes
* Connection - The type of connection used to transfer the response
* Conekta-Media-Type -
422 whitelist validation error -
500 internal server error -
*/
public GetChargesResponse getCharges(String acceptLanguage, String xChildCompanyId, Integer limit, String search, String next, String previous) throws ApiException {
return getChargesWithHttpInfo(acceptLanguage, xChildCompanyId, limit, search, next, previous).getData();
}
/**
* Get A List of Charges
*
* @param acceptLanguage Use for knowing which language to use (optional, default to es)
* @param xChildCompanyId In the case of a holding company, the company id of the child company to which will process the request. (optional)
* @param limit The numbers of items to return, the maximum value is 250 (optional, default to 20)
* @param search General order search, e.g. by mail, reference etc. (optional)
* @param next next page (optional)
* @param previous previous page (optional)
* @return ApiResponse<GetChargesResponse>
* @throws ApiException if fails to make API call
* @http.response.details
Status Code Description Response Headers
200 successful * Date - The date and time that the response was sent
* Content-Type - The format of the response body
* Content-Length - The length of the response body in bytes
* Connection - The type of connection used to transfer the response
* Conekta-Media-Type -
422 whitelist validation error -
500 internal server error -
*/
public ApiResponse getChargesWithHttpInfo(String acceptLanguage, String xChildCompanyId, Integer limit, String search, String next, String previous) throws ApiException {
// Query parameters
List localVarQueryParams = new ArrayList<>(
apiClient.parameterToPairs("", "limit", limit)
);
localVarQueryParams.addAll(apiClient.parameterToPairs("", "search", search));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "next", next));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "previous", previous));
// Header parameters
Map localVarHeaderParams = new LinkedHashMap<>();
if (acceptLanguage != null) {
localVarHeaderParams.put("Accept-Language", apiClient.parameterToString(acceptLanguage));
}
if (xChildCompanyId != null) {
localVarHeaderParams.put("X-Child-Company-Id", apiClient.parameterToString(xChildCompanyId));
}
String localVarAccept = apiClient.selectHeaderAccept("application/vnd.conekta-v2.1.0+json");
String localVarContentType = apiClient.selectHeaderContentType();
String[] localVarAuthNames = new String[] {"bearerAuth"};
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI("ChargesApi.getCharges", "/charges", "GET", localVarQueryParams, null,
localVarHeaderParams, new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType,
localVarAuthNames, localVarReturnType, false);
}
/**
* Create charge
* Create charge for an existing orden
* @param id Identifier of the resource (required)
* @param chargeRequest requested field for a charge (required)
* @param acceptLanguage Use for knowing which language to use (optional, default to es)
* @param xChildCompanyId In the case of a holding company, the company id of the child company to which will process the request. (optional)
* @return ChargeOrderResponse
* @throws ApiException if fails to make API call
* @http.response.details
Status Code Description Response Headers
200 successful -
401 authentication error -
404 not found entity -
428 Precondition Required -
500 internal server error -
*/
public ChargeOrderResponse ordersCreateCharge(String id, ChargeRequest chargeRequest, String acceptLanguage, String xChildCompanyId) throws ApiException {
return ordersCreateChargeWithHttpInfo(id, chargeRequest, acceptLanguage, xChildCompanyId).getData();
}
/**
* Create charge
* Create charge for an existing orden
* @param id Identifier of the resource (required)
* @param chargeRequest requested field for a charge (required)
* @param acceptLanguage Use for knowing which language to use (optional, default to es)
* @param xChildCompanyId In the case of a holding company, the company id of the child company to which will process the request. (optional)
* @return ApiResponse<ChargeOrderResponse>
* @throws ApiException if fails to make API call
* @http.response.details
Status Code Description Response Headers
200 successful -
401 authentication error -
404 not found entity -
428 Precondition Required -
500 internal server error -
*/
public ApiResponse ordersCreateChargeWithHttpInfo(String id, ChargeRequest chargeRequest, String acceptLanguage, String xChildCompanyId) throws ApiException {
// Check required parameters
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling ordersCreateCharge");
}
if (chargeRequest == null) {
throw new ApiException(400, "Missing the required parameter 'chargeRequest' when calling ordersCreateCharge");
}
// Path parameters
String localVarPath = "/orders/{id}/charges"
.replaceAll("\\{id}", apiClient.escapeString(id));
// Header parameters
Map localVarHeaderParams = new LinkedHashMap<>();
if (acceptLanguage != null) {
localVarHeaderParams.put("Accept-Language", apiClient.parameterToString(acceptLanguage));
}
if (xChildCompanyId != null) {
localVarHeaderParams.put("X-Child-Company-Id", apiClient.parameterToString(xChildCompanyId));
}
String localVarAccept = apiClient.selectHeaderAccept("application/vnd.conekta-v2.1.0+json");
String localVarContentType = apiClient.selectHeaderContentType("application/json");
String[] localVarAuthNames = new String[] {"bearerAuth"};
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI("ChargesApi.ordersCreateCharge", localVarPath, "POST", new ArrayList<>(), chargeRequest,
localVarHeaderParams, new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType,
localVarAuthNames, localVarReturnType, false);
}
/**
* Update a charge
*
* @param id Identifier of the resource (required)
* @param chargeUpdateRequest requested field for update a charge (required)
* @param acceptLanguage Use for knowing which language to use (optional, default to es)
* @param xChildCompanyId In the case of a holding company, the company id of the child company to which will process the request. (optional)
* @return ChargeResponse
* @throws ApiException if fails to make API call
* @http.response.details
Status Code Description Response Headers
200 successful * Date - The date and time that the response was sent
* Content-Type - The format of the response body
* Content-Length - The length of the response body in bytes
* Connection - The type of connection used to transfer the response
* Conekta-Media-Type -
422 whitelist validation error -
404 not found entity -
500 internal server error -
*/
public ChargeResponse updateCharge(String id, ChargeUpdateRequest chargeUpdateRequest, String acceptLanguage, String xChildCompanyId) throws ApiException {
return updateChargeWithHttpInfo(id, chargeUpdateRequest, acceptLanguage, xChildCompanyId).getData();
}
/**
* Update a charge
*
* @param id Identifier of the resource (required)
* @param chargeUpdateRequest requested field for update a charge (required)
* @param acceptLanguage Use for knowing which language to use (optional, default to es)
* @param xChildCompanyId In the case of a holding company, the company id of the child company to which will process the request. (optional)
* @return ApiResponse<ChargeResponse>
* @throws ApiException if fails to make API call
* @http.response.details
Status Code Description Response Headers
200 successful * Date - The date and time that the response was sent
* Content-Type - The format of the response body
* Content-Length - The length of the response body in bytes
* Connection - The type of connection used to transfer the response
* Conekta-Media-Type -
422 whitelist validation error -
404 not found entity -
500 internal server error -
*/
public ApiResponse updateChargeWithHttpInfo(String id, ChargeUpdateRequest chargeUpdateRequest, String acceptLanguage, String xChildCompanyId) throws ApiException {
// Check required parameters
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling updateCharge");
}
if (chargeUpdateRequest == null) {
throw new ApiException(400, "Missing the required parameter 'chargeUpdateRequest' when calling updateCharge");
}
// Path parameters
String localVarPath = "/charges/{id}"
.replaceAll("\\{id}", apiClient.escapeString(id));
// Header parameters
Map localVarHeaderParams = new LinkedHashMap<>();
if (acceptLanguage != null) {
localVarHeaderParams.put("Accept-Language", apiClient.parameterToString(acceptLanguage));
}
if (xChildCompanyId != null) {
localVarHeaderParams.put("X-Child-Company-Id", apiClient.parameterToString(xChildCompanyId));
}
String localVarAccept = apiClient.selectHeaderAccept("application/vnd.conekta-v2.1.0+json");
String localVarContentType = apiClient.selectHeaderContentType("application/json");
String[] localVarAuthNames = new String[] {"bearerAuth"};
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI("ChargesApi.updateCharge", localVarPath, "PUT", new ArrayList<>(), chargeUpdateRequest,
localVarHeaderParams, new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType,
localVarAuthNames, localVarReturnType, false);
}
}