All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.conekta.TokensApi Maven / Gradle / Ivy

Go to download

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.Error;
import com.conekta.model.Token;
import com.conekta.model.TokenResponse;

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 TokensApi {
  private ApiClient apiClient;

  public TokensApi() {
    this(Configuration.getDefaultApiClient());
  }

  public TokensApi(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;
  }

  /**
   * Create Token
   * Generate a payment token, to associate it with a card 
   * @param token requested field for token (required)
   * @param acceptLanguage Use for knowing which language to use (optional, default to es)
   * @return TokenResponse
   * @throws ApiException if fails to make API call
   * @http.response.details
     
Status Code Description Response Headers
200 successful operation * 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 -
401 authentication error -
422 parameter validation error -
500 internal server error -
*/ public TokenResponse createToken(Token token, String acceptLanguage) throws ApiException { return createTokenWithHttpInfo(token, acceptLanguage).getData(); } /** * Create Token * Generate a payment token, to associate it with a card * @param token requested field for token (required) * @param acceptLanguage Use for knowing which language to use (optional, default to es) * @return ApiResponse<TokenResponse> * @throws ApiException if fails to make API call * @http.response.details
Status Code Description Response Headers
200 successful operation * 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 -
401 authentication error -
422 parameter validation error -
500 internal server error -
*/ public ApiResponse createTokenWithHttpInfo(Token token, String acceptLanguage) throws ApiException { // Check required parameters if (token == null) { throw new ApiException(400, "Missing the required parameter 'token' when calling createToken"); } // Header parameters Map localVarHeaderParams = new LinkedHashMap<>(); if (acceptLanguage != null) { localVarHeaderParams.put("Accept-Language", apiClient.parameterToString(acceptLanguage)); } 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("TokensApi.createToken", "/tokens", "POST", new ArrayList<>(), token, localVarHeaderParams, new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType, false); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy