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

de.adorsys.multibanking.banking_gateway_b2c.api.PisApi Maven / Gradle / Ivy

/*
 * Bankinggateway B2C Rest API
 * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
 *
 * OpenAPI spec version: 0.2-SNAPSHOT
 * 
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */

package de.adorsys.multibanking.banking_gateway_b2c.api;

import de.adorsys.multibanking.banking_gateway_b2c.ApiCallback;
import de.adorsys.multibanking.banking_gateway_b2c.ApiClient;
import de.adorsys.multibanking.banking_gateway_b2c.ApiException;
import de.adorsys.multibanking.banking_gateway_b2c.ApiResponse;
import de.adorsys.multibanking.banking_gateway_b2c.Configuration;
import de.adorsys.multibanking.banking_gateway_b2c.Pair;
import de.adorsys.multibanking.banking_gateway_b2c.ProgressRequestBody;
import de.adorsys.multibanking.banking_gateway_b2c.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import de.adorsys.multibanking.banking_gateway_b2c.model.MessagesTO;
import de.adorsys.multibanking.banking_gateway_b2c.model.ResourcePaymentDataTO;
import de.adorsys.multibanking.banking_gateway_b2c.model.ResourceUpdateAuthResponseTO;
import de.adorsys.multibanking.banking_gateway_b2c.model.SelectPsuAuthenticationMethodRequestTO;
import de.adorsys.multibanking.banking_gateway_b2c.model.TransactionAuthorisationRequestTO;
import de.adorsys.multibanking.banking_gateway_b2c.model.UpdatePsuAuthenticationRequestTO;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class PisApi {
    private ApiClient apiClient;

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

    public PisApi(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    /**
     * Build call for getPayment
     * @param paymentId  (required)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call getPaymentCall(String paymentId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/v1/payments/{paymentId}"
            .replaceAll("\\{" + "paymentId" + "\\}", apiClient.escapeString(paymentId.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "*/*"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "bg_auth" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call getPaymentValidateBeforeCall(String paymentId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'paymentId' is set
        if (paymentId == null) {
            throw new ApiException("Missing the required parameter 'paymentId' when calling getPayment(Async)");
        }
        
        com.squareup.okhttp.Call call = getPaymentCall(paymentId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * 
     * Get payment information
     * @param paymentId  (required)
     * @return ResourcePaymentDataTO
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ResourcePaymentDataTO getPayment(String paymentId) throws ApiException {
        ApiResponse resp = getPaymentWithHttpInfo(paymentId);
        return resp.getData();
    }

    /**
     * 
     * Get payment information
     * @param paymentId  (required)
     * @return ApiResponse<ResourcePaymentDataTO>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse getPaymentWithHttpInfo(String paymentId) throws ApiException {
        com.squareup.okhttp.Call call = getPaymentValidateBeforeCall(paymentId, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * Get payment information
     * @param paymentId  (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call getPaymentAsync(String paymentId, final ApiCallback callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        com.squareup.okhttp.Call call = getPaymentValidateBeforeCall(paymentId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getPaymentAuthorisationStatus
     * @param paymentId  (required)
     * @param authorisationId  (required)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call getPaymentAuthorisationStatusCall(String paymentId, String authorisationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/v1/payments/{paymentId}/authorisations/{authorisationId}"
            .replaceAll("\\{" + "paymentId" + "\\}", apiClient.escapeString(paymentId.toString()))
            .replaceAll("\\{" + "authorisationId" + "\\}", apiClient.escapeString(authorisationId.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "*/*"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "bg_auth" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call getPaymentAuthorisationStatusValidateBeforeCall(String paymentId, String authorisationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'paymentId' is set
        if (paymentId == null) {
            throw new ApiException("Missing the required parameter 'paymentId' when calling getPaymentAuthorisationStatus(Async)");
        }
        // verify the required parameter 'authorisationId' is set
        if (authorisationId == null) {
            throw new ApiException("Missing the required parameter 'authorisationId' when calling getPaymentAuthorisationStatus(Async)");
        }
        
        com.squareup.okhttp.Call call = getPaymentAuthorisationStatusCall(paymentId, authorisationId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * 
     * Get payment authorisation status
     * @param paymentId  (required)
     * @param authorisationId  (required)
     * @return ResourceUpdateAuthResponseTO
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ResourceUpdateAuthResponseTO getPaymentAuthorisationStatus(String paymentId, String authorisationId) throws ApiException {
        ApiResponse resp = getPaymentAuthorisationStatusWithHttpInfo(paymentId, authorisationId);
        return resp.getData();
    }

    /**
     * 
     * Get payment authorisation status
     * @param paymentId  (required)
     * @param authorisationId  (required)
     * @return ApiResponse<ResourceUpdateAuthResponseTO>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse getPaymentAuthorisationStatusWithHttpInfo(String paymentId, String authorisationId) throws ApiException {
        com.squareup.okhttp.Call call = getPaymentAuthorisationStatusValidateBeforeCall(paymentId, authorisationId, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * Get payment authorisation status
     * @param paymentId  (required)
     * @param authorisationId  (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call getPaymentAuthorisationStatusAsync(String paymentId, String authorisationId, final ApiCallback callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        com.squareup.okhttp.Call call = getPaymentAuthorisationStatusValidateBeforeCall(paymentId, authorisationId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for selectPsuAuthenticationMethod1
     * @param paymentId  (required)
     * @param authorisationId  (required)
     * @param body  (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call selectPsuAuthenticationMethod1Call(String paymentId, String authorisationId, SelectPsuAuthenticationMethodRequestTO body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;
        
        // create path and map variables
        String localVarPath = "/v1/payments/{paymentId}/authorisations/{authorisationId}/selectPsuAuthenticationMethod"
            .replaceAll("\\{" + "paymentId" + "\\}", apiClient.escapeString(paymentId.toString()))
            .replaceAll("\\{" + "authorisationId" + "\\}", apiClient.escapeString(authorisationId.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "*/*"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "bg_auth" };
        return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call selectPsuAuthenticationMethod1ValidateBeforeCall(String paymentId, String authorisationId, SelectPsuAuthenticationMethodRequestTO body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'paymentId' is set
        if (paymentId == null) {
            throw new ApiException("Missing the required parameter 'paymentId' when calling selectPsuAuthenticationMethod1(Async)");
        }
        // verify the required parameter 'authorisationId' is set
        if (authorisationId == null) {
            throw new ApiException("Missing the required parameter 'authorisationId' when calling selectPsuAuthenticationMethod1(Async)");
        }
        
        com.squareup.okhttp.Call call = selectPsuAuthenticationMethod1Call(paymentId, authorisationId, body, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * 
     * Update authorisation (select SCA method)
     * @param paymentId  (required)
     * @param authorisationId  (required)
     * @param body  (optional)
     * @return ResourceUpdateAuthResponseTO
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ResourceUpdateAuthResponseTO selectPsuAuthenticationMethod1(String paymentId, String authorisationId, SelectPsuAuthenticationMethodRequestTO body) throws ApiException {
        ApiResponse resp = selectPsuAuthenticationMethod1WithHttpInfo(paymentId, authorisationId, body);
        return resp.getData();
    }

    /**
     * 
     * Update authorisation (select SCA method)
     * @param paymentId  (required)
     * @param authorisationId  (required)
     * @param body  (optional)
     * @return ApiResponse<ResourceUpdateAuthResponseTO>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse selectPsuAuthenticationMethod1WithHttpInfo(String paymentId, String authorisationId, SelectPsuAuthenticationMethodRequestTO body) throws ApiException {
        com.squareup.okhttp.Call call = selectPsuAuthenticationMethod1ValidateBeforeCall(paymentId, authorisationId, body, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * Update authorisation (select SCA method)
     * @param paymentId  (required)
     * @param authorisationId  (required)
     * @param body  (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call selectPsuAuthenticationMethod1Async(String paymentId, String authorisationId, SelectPsuAuthenticationMethodRequestTO body, final ApiCallback callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        com.squareup.okhttp.Call call = selectPsuAuthenticationMethod1ValidateBeforeCall(paymentId, authorisationId, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for transactionAuthorisation1
     * @param paymentId  (required)
     * @param authorisationId  (required)
     * @param body  (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call transactionAuthorisation1Call(String paymentId, String authorisationId, TransactionAuthorisationRequestTO body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;
        
        // create path and map variables
        String localVarPath = "/v1/payments/{paymentId}/authorisations/{authorisationId}/transactionAuthorisation"
            .replaceAll("\\{" + "paymentId" + "\\}", apiClient.escapeString(paymentId.toString()))
            .replaceAll("\\{" + "authorisationId" + "\\}", apiClient.escapeString(authorisationId.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "*/*"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "bg_auth" };
        return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call transactionAuthorisation1ValidateBeforeCall(String paymentId, String authorisationId, TransactionAuthorisationRequestTO body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'paymentId' is set
        if (paymentId == null) {
            throw new ApiException("Missing the required parameter 'paymentId' when calling transactionAuthorisation1(Async)");
        }
        // verify the required parameter 'authorisationId' is set
        if (authorisationId == null) {
            throw new ApiException("Missing the required parameter 'authorisationId' when calling transactionAuthorisation1(Async)");
        }
        
        com.squareup.okhttp.Call call = transactionAuthorisation1Call(paymentId, authorisationId, body, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * 
     * Update authorisation (authorize transaction)
     * @param paymentId  (required)
     * @param authorisationId  (required)
     * @param body  (optional)
     * @return ResourceUpdateAuthResponseTO
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ResourceUpdateAuthResponseTO transactionAuthorisation1(String paymentId, String authorisationId, TransactionAuthorisationRequestTO body) throws ApiException {
        ApiResponse resp = transactionAuthorisation1WithHttpInfo(paymentId, authorisationId, body);
        return resp.getData();
    }

    /**
     * 
     * Update authorisation (authorize transaction)
     * @param paymentId  (required)
     * @param authorisationId  (required)
     * @param body  (optional)
     * @return ApiResponse<ResourceUpdateAuthResponseTO>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse transactionAuthorisation1WithHttpInfo(String paymentId, String authorisationId, TransactionAuthorisationRequestTO body) throws ApiException {
        com.squareup.okhttp.Call call = transactionAuthorisation1ValidateBeforeCall(paymentId, authorisationId, body, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * Update authorisation (authorize transaction)
     * @param paymentId  (required)
     * @param authorisationId  (required)
     * @param body  (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call transactionAuthorisation1Async(String paymentId, String authorisationId, TransactionAuthorisationRequestTO body, final ApiCallback callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        com.squareup.okhttp.Call call = transactionAuthorisation1ValidateBeforeCall(paymentId, authorisationId, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for updatePsuAuthentication1
     * @param paymentId  (required)
     * @param authorisationId  (required)
     * @param body  (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call updatePsuAuthentication1Call(String paymentId, String authorisationId, UpdatePsuAuthenticationRequestTO body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;
        
        // create path and map variables
        String localVarPath = "/v1/payments/{paymentId}/authorisations/{authorisationId}/updatePsuAuthentication"
            .replaceAll("\\{" + "paymentId" + "\\}", apiClient.escapeString(paymentId.toString()))
            .replaceAll("\\{" + "authorisationId" + "\\}", apiClient.escapeString(authorisationId.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "*/*"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "bg_auth" };
        return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call updatePsuAuthentication1ValidateBeforeCall(String paymentId, String authorisationId, UpdatePsuAuthenticationRequestTO body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'paymentId' is set
        if (paymentId == null) {
            throw new ApiException("Missing the required parameter 'paymentId' when calling updatePsuAuthentication1(Async)");
        }
        // verify the required parameter 'authorisationId' is set
        if (authorisationId == null) {
            throw new ApiException("Missing the required parameter 'authorisationId' when calling updatePsuAuthentication1(Async)");
        }
        
        com.squareup.okhttp.Call call = updatePsuAuthentication1Call(paymentId, authorisationId, body, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * 
     * Update authorisation (authenticate user)
     * @param paymentId  (required)
     * @param authorisationId  (required)
     * @param body  (optional)
     * @return ResourceUpdateAuthResponseTO
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ResourceUpdateAuthResponseTO updatePsuAuthentication1(String paymentId, String authorisationId, UpdatePsuAuthenticationRequestTO body) throws ApiException {
        ApiResponse resp = updatePsuAuthentication1WithHttpInfo(paymentId, authorisationId, body);
        return resp.getData();
    }

    /**
     * 
     * Update authorisation (authenticate user)
     * @param paymentId  (required)
     * @param authorisationId  (required)
     * @param body  (optional)
     * @return ApiResponse<ResourceUpdateAuthResponseTO>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse updatePsuAuthentication1WithHttpInfo(String paymentId, String authorisationId, UpdatePsuAuthenticationRequestTO body) throws ApiException {
        com.squareup.okhttp.Call call = updatePsuAuthentication1ValidateBeforeCall(paymentId, authorisationId, body, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * Update authorisation (authenticate user)
     * @param paymentId  (required)
     * @param authorisationId  (required)
     * @param body  (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call updatePsuAuthentication1Async(String paymentId, String authorisationId, UpdatePsuAuthenticationRequestTO body, final ApiCallback callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        com.squareup.okhttp.Call call = updatePsuAuthentication1ValidateBeforeCall(paymentId, authorisationId, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy