io.trippay.sdk.payment.api.AgentApi Maven / Gradle / Ivy
Show all versions of payment-sdk-java Show documentation
package io.trippay.sdk.payment.api;
import io.trippay.sdk.payment.invoker.ApiClient;
import io.trippay.sdk.payment.model.CreateAgentSaleRequest;
import io.trippay.sdk.payment.model.MultiBookingContractResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.web.reactive.function.client.WebClient.ResponseSpec;
import org.springframework.web.reactive.function.client.WebClientResponseException;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import reactor.core.publisher.Mono;
import reactor.core.publisher.Flux;
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-12T10:13:49.239999511+07:00[Asia/Bangkok]")
public class AgentApi {
private ApiClient apiClient;
public AgentApi() {
this(new ApiClient());
}
@Autowired
public AgentApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Create Agent Payment
* Attempt an immediate payment with Agent as acquirer. Checks for valid funds in account before booking instruction.
* 201 - Created
* @param createAgentSaleRequest The createAgentSaleRequest parameter
* @param winkVersion The winkVersion parameter
* @return MultiBookingContractResponse
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
private ResponseSpec createAgentSaleRequestCreation(CreateAgentSaleRequest createAgentSaleRequest, String winkVersion) throws WebClientResponseException {
Object postBody = createAgentSaleRequest;
// verify the required parameter 'createAgentSaleRequest' is set
if (createAgentSaleRequest == null) {
throw new WebClientResponseException("Missing the required parameter 'createAgentSaleRequest' when calling createAgentSale", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
}
// create path and map variables
final Map pathParams = new HashMap();
final MultiValueMap queryParams = new LinkedMultiValueMap();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap cookieParams = new LinkedMultiValueMap();
final MultiValueMap formParams = new LinkedMultiValueMap();
if (winkVersion != null)
headerParams.add("Wink-Version", apiClient.parameterToString(winkVersion));
final String[] localVarAccepts = {
"application/json"
};
final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2ClientCredentials" };
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return apiClient.invokeAPI("/api/contract/agent", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Create Agent Payment
* Attempt an immediate payment with Agent as acquirer. Checks for valid funds in account before booking instruction.
* 201 - Created
* @param createAgentSaleRequest The createAgentSaleRequest parameter
* @param winkVersion The winkVersion parameter
* @return MultiBookingContractResponse
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
public Mono createAgentSale(CreateAgentSaleRequest createAgentSaleRequest, String winkVersion) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return createAgentSaleRequestCreation(createAgentSaleRequest, winkVersion).bodyToMono(localVarReturnType);
}
/**
* Create Agent Payment
* Attempt an immediate payment with Agent as acquirer. Checks for valid funds in account before booking instruction.
* 201 - Created
* @param createAgentSaleRequest The createAgentSaleRequest parameter
* @param winkVersion The winkVersion parameter
* @return ResponseEntity<MultiBookingContractResponse>
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
public Mono> createAgentSaleWithHttpInfo(CreateAgentSaleRequest createAgentSaleRequest, String winkVersion) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return createAgentSaleRequestCreation(createAgentSaleRequest, winkVersion).toEntity(localVarReturnType);
}
/**
* Create Agent Payment
* Attempt an immediate payment with Agent as acquirer. Checks for valid funds in account before booking instruction.
* 201 - Created
* @param createAgentSaleRequest The createAgentSaleRequest parameter
* @param winkVersion The winkVersion parameter
* @return ResponseSpec
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
public ResponseSpec createAgentSaleWithResponseSpec(CreateAgentSaleRequest createAgentSaleRequest, String winkVersion) throws WebClientResponseException {
return createAgentSaleRequestCreation(createAgentSaleRequest, winkVersion);
}
}