tech.carpentum.sdk.payment.internal.generated.api.MerchantInfoApi.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of payment-client-v2 Show documentation
Show all versions of payment-client-v2 Show documentation
Carpentum Payment system Java SDK
/**
* Public API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: see README!
*
*
* Please note:
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* Do not edit this file manually.
*/
@file:Suppress(
"ArrayInDataClass",
"EnumEntryName",
"RemoveRedundantQualifierName",
"UnusedImport"
)
package tech.carpentum.sdk.payment.internal.generated.api
import java.io.IOException
import tech.carpentum.sdk.payment.model.BasicError
import tech.carpentum.sdk.payment.model.MerchantInfo
import com.squareup.moshi.Json
import tech.carpentum.sdk.payment.internal.generated.infrastructure.ApiClient
import tech.carpentum.sdk.payment.internal.generated.infrastructure.ApiResponse
import tech.carpentum.sdk.payment.internal.generated.infrastructure.ClientException
import tech.carpentum.sdk.payment.internal.generated.infrastructure.ClientError
import tech.carpentum.sdk.payment.internal.generated.infrastructure.ServerException
import tech.carpentum.sdk.payment.internal.generated.infrastructure.ServerError
import tech.carpentum.sdk.payment.internal.generated.infrastructure.MultiValueMap
import tech.carpentum.sdk.payment.internal.generated.infrastructure.RequestConfig
import tech.carpentum.sdk.payment.internal.generated.infrastructure.RequestMethod
import tech.carpentum.sdk.payment.internal.generated.infrastructure.ResponseType
import tech.carpentum.sdk.payment.internal.generated.infrastructure.Success
import tech.carpentum.sdk.payment.internal.generated.infrastructure.toMultiValue
internal open class MerchantInfoApi(basePath: kotlin.String = defaultBasePath, client: okhttp3.OkHttpClient) : ApiClient(basePath, client) {
companion object {
@JvmStatic
val defaultBasePath: String by lazy {
System.getProperties().getProperty(ApiClient.baseUrlKey, "https://api.sandbox.carpentum.tech")
}
}
/**
* Merchant information.
* Return information about the merchant authorised by [JWT token](general.html#security).
* @param xAPIVersion Required API version. See [Versioning](general.html#versioning)
* @return MerchantInfo
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
* @throws UnsupportedOperationException If the API returns an informational or redirection response
* @throws ClientException If the API returns a client error response
* @throws ServerException If the API returns a server error response
*/
@Suppress("UNCHECKED_CAST")
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getMerchantInfo(xAPIVersion: kotlin.Int) : MerchantInfo {
val localVarResponse = getMerchantInfoWithHttpInfo(xAPIVersion = xAPIVersion)
return when (localVarResponse.responseType) {
ResponseType.Success -> (localVarResponse as Success<*>).data as MerchantInfo
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> {
val localVarError = localVarResponse as ClientError<*>
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
}
ResponseType.ServerError -> {
val localVarError = localVarResponse as ServerError<*>
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
}
}
}
/**
* Merchant information.
* Return information about the merchant authorised by [JWT token](general.html#security).
* @param xAPIVersion Required API version. See [Versioning](general.html#versioning)
* @return ApiResponse
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Suppress("UNCHECKED_CAST")
@Throws(IllegalStateException::class, IOException::class)
fun getMerchantInfoWithHttpInfo(xAPIVersion: kotlin.Int) : ApiResponse {
val localVariableConfig = getMerchantInfoRequestConfig(xAPIVersion = xAPIVersion)
return request(
localVariableConfig
)
}
/**
* To obtain the request config of the operation getMerchantInfo
*
* @param xAPIVersion Required API version. See [Versioning](general.html#versioning)
* @return RequestConfig
*/
fun getMerchantInfoRequestConfig(xAPIVersion: kotlin.Int) : RequestConfig {
val localVariableBody = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap = mutableMapOf()
xAPIVersion.apply { localVariableHeaders["X-API-Version"] = this.toString() }
localVariableHeaders["Accept"] = "application/json"
return RequestConfig(
method = RequestMethod.GET,
path = "/merchant-info",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy