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

de.adorsys.multibanking.banking_gateway_b2c.api.AisApi 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.ConsentTO;
import de.adorsys.multibanking.banking_gateway_b2c.model.CreateConsentResponseTO;
import de.adorsys.multibanking.banking_gateway_b2c.model.MessagesTO;
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 AisApi {
    private ApiClient apiClient;

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

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /**
     * Build call for createConsent
     * @param xGTWBankCode  (required)
     * @param body  (optional)
     * @param PSU_ID  (optional)
     * @param psUCorporateID  (optional)
     * @param tpPRedirectPreferred  (optional)
     * @param tpPRedirectURI  (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 createConsentCall(String xGTWBankCode, ConsentTO body, String PSU_ID, String psUCorporateID, Boolean tpPRedirectPreferred, String tpPRedirectURI, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;
        
        // create path and map variables
        String localVarPath = "/v1/ais/consents";

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

        Map localVarHeaderParams = new HashMap();
        if (PSU_ID != null)
        localVarHeaderParams.put("PSU-ID", apiClient.parameterToString(PSU_ID));
        if (psUCorporateID != null)
        localVarHeaderParams.put("PSU-Corporate-ID", apiClient.parameterToString(psUCorporateID));
        if (tpPRedirectPreferred != null)
        localVarHeaderParams.put("TPP-Redirect-Preferred", apiClient.parameterToString(tpPRedirectPreferred));
        if (tpPRedirectURI != null)
        localVarHeaderParams.put("TPP-Redirect-URI", apiClient.parameterToString(tpPRedirectURI));
        if (xGTWBankCode != null)
        localVarHeaderParams.put("X-GTW-Bank-Code", apiClient.parameterToString(xGTWBankCode));

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "application/json", "*/*"
        };
        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, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call createConsentValidateBeforeCall(String xGTWBankCode, ConsentTO body, String PSU_ID, String psUCorporateID, Boolean tpPRedirectPreferred, String tpPRedirectURI, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'xGTWBankCode' is set
        if (xGTWBankCode == null) {
            throw new ApiException("Missing the required parameter 'xGTWBankCode' when calling createConsent(Async)");
        }
        
        com.squareup.okhttp.Call call = createConsentCall(xGTWBankCode, body, PSU_ID, psUCorporateID, tpPRedirectPreferred, tpPRedirectURI, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * 
     * Create AIS consent
     * @param xGTWBankCode  (required)
     * @param body  (optional)
     * @param PSU_ID  (optional)
     * @param psUCorporateID  (optional)
     * @param tpPRedirectPreferred  (optional)
     * @param tpPRedirectURI  (optional)
     * @return CreateConsentResponseTO
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public CreateConsentResponseTO createConsent(String xGTWBankCode, ConsentTO body, String PSU_ID, String psUCorporateID, Boolean tpPRedirectPreferred, String tpPRedirectURI) throws ApiException {
        ApiResponse resp = createConsentWithHttpInfo(xGTWBankCode, body, PSU_ID, psUCorporateID, tpPRedirectPreferred, tpPRedirectURI);
        return resp.getData();
    }

    /**
     * 
     * Create AIS consent
     * @param xGTWBankCode  (required)
     * @param body  (optional)
     * @param PSU_ID  (optional)
     * @param psUCorporateID  (optional)
     * @param tpPRedirectPreferred  (optional)
     * @param tpPRedirectURI  (optional)
     * @return ApiResponse<CreateConsentResponseTO>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse createConsentWithHttpInfo(String xGTWBankCode, ConsentTO body, String PSU_ID, String psUCorporateID, Boolean tpPRedirectPreferred, String tpPRedirectURI) throws ApiException {
        com.squareup.okhttp.Call call = createConsentValidateBeforeCall(xGTWBankCode, body, PSU_ID, psUCorporateID, tpPRedirectPreferred, tpPRedirectURI, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * Create AIS consent
     * @param xGTWBankCode  (required)
     * @param body  (optional)
     * @param PSU_ID  (optional)
     * @param psUCorporateID  (optional)
     * @param tpPRedirectPreferred  (optional)
     * @param tpPRedirectURI  (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 createConsentAsync(String xGTWBankCode, ConsentTO body, String PSU_ID, String psUCorporateID, Boolean tpPRedirectPreferred, String tpPRedirectURI, 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 = createConsentValidateBeforeCall(xGTWBankCode, body, PSU_ID, psUCorporateID, tpPRedirectPreferred, tpPRedirectURI, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getConsent
     * @param consentId  (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 getConsentCall(String consentId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/v1/ais/consents/{consentId}"
            .replaceAll("\\{" + "consentId" + "\\}", apiClient.escapeString(consentId.toString()));

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

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "application/json", "*/*"
        };
        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 getConsentValidateBeforeCall(String consentId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'consentId' is set
        if (consentId == null) {
            throw new ApiException("Missing the required parameter 'consentId' when calling getConsent(Async)");
        }
        
        com.squareup.okhttp.Call call = getConsentCall(consentId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * 
     * Get AIS consent by consent id
     * @param consentId  (required)
     * @return ConsentTO
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ConsentTO getConsent(String consentId) throws ApiException {
        ApiResponse resp = getConsentWithHttpInfo(consentId);
        return resp.getData();
    }

    /**
     * 
     * Get AIS consent by consent id
     * @param consentId  (required)
     * @return ApiResponse<ConsentTO>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse getConsentWithHttpInfo(String consentId) throws ApiException {
        com.squareup.okhttp.Call call = getConsentValidateBeforeCall(consentId, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * Get AIS consent by consent id
     * @param consentId  (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 getConsentAsync(String consentId, 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 = getConsentValidateBeforeCall(consentId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getConsentAuthorisationStatus
     * @param consentId  (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 getConsentAuthorisationStatusCall(String consentId, String authorisationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/v1/consents/{consentId}/authorisations/{authorisationId}"
            .replaceAll("\\{" + "consentId" + "\\}", apiClient.escapeString(consentId.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 getConsentAuthorisationStatusValidateBeforeCall(String consentId, String authorisationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'consentId' is set
        if (consentId == null) {
            throw new ApiException("Missing the required parameter 'consentId' when calling getConsentAuthorisationStatus(Async)");
        }
        // verify the required parameter 'authorisationId' is set
        if (authorisationId == null) {
            throw new ApiException("Missing the required parameter 'authorisationId' when calling getConsentAuthorisationStatus(Async)");
        }
        
        com.squareup.okhttp.Call call = getConsentAuthorisationStatusCall(consentId, authorisationId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * 
     * Get consent authorisation status
     * @param consentId  (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 getConsentAuthorisationStatus(String consentId, String authorisationId) throws ApiException {
        ApiResponse resp = getConsentAuthorisationStatusWithHttpInfo(consentId, authorisationId);
        return resp.getData();
    }

    /**
     * 
     * Get consent authorisation status
     * @param consentId  (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 getConsentAuthorisationStatusWithHttpInfo(String consentId, String authorisationId) throws ApiException {
        com.squareup.okhttp.Call call = getConsentAuthorisationStatusValidateBeforeCall(consentId, authorisationId, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * Get consent authorisation status
     * @param consentId  (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 getConsentAuthorisationStatusAsync(String consentId, 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 = getConsentAuthorisationStatusValidateBeforeCall(consentId, authorisationId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getConsentStatus
     * @param consentId  (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 getConsentStatusCall(String consentId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/v1/ais/consents/{consentId}/status"
            .replaceAll("\\{" + "consentId" + "\\}", apiClient.escapeString(consentId.toString()));

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

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "application/json", "*/*"
        };
        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 getConsentStatusValidateBeforeCall(String consentId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'consentId' is set
        if (consentId == null) {
            throw new ApiException("Missing the required parameter 'consentId' when calling getConsentStatus(Async)");
        }
        
        com.squareup.okhttp.Call call = getConsentStatusCall(consentId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * 
     * Get AIS consent status by consent id
     * @param consentId  (required)
     * @return String
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public String getConsentStatus(String consentId) throws ApiException {
        ApiResponse resp = getConsentStatusWithHttpInfo(consentId);
        return resp.getData();
    }

    /**
     * 
     * Get AIS consent status by consent id
     * @param consentId  (required)
     * @return ApiResponse<String>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse getConsentStatusWithHttpInfo(String consentId) throws ApiException {
        com.squareup.okhttp.Call call = getConsentStatusValidateBeforeCall(consentId, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * Get AIS consent status by consent id
     * @param consentId  (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 getConsentStatusAsync(String consentId, 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 = getConsentStatusValidateBeforeCall(consentId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for revokeConsent
     * @param consentId  (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 revokeConsentCall(String consentId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/v1/ais/consents/{consentId}"
            .replaceAll("\\{" + "consentId" + "\\}", apiClient.escapeString(consentId.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, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call revokeConsentValidateBeforeCall(String consentId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'consentId' is set
        if (consentId == null) {
            throw new ApiException("Missing the required parameter 'consentId' when calling revokeConsent(Async)");
        }
        
        com.squareup.okhttp.Call call = revokeConsentCall(consentId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * 
     * Revoke consent by consent id
     * @param consentId  (required)
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public void revokeConsent(String consentId) throws ApiException {
        revokeConsentWithHttpInfo(consentId);
    }

    /**
     * 
     * Revoke consent by consent id
     * @param consentId  (required)
     * @return ApiResponse<Void>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse revokeConsentWithHttpInfo(String consentId) throws ApiException {
        com.squareup.okhttp.Call call = revokeConsentValidateBeforeCall(consentId, null, null);
        return apiClient.execute(call);
    }

    /**
     *  (asynchronously)
     * Revoke consent by consent id
     * @param consentId  (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 revokeConsentAsync(String consentId, 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 = revokeConsentValidateBeforeCall(consentId, progressListener, progressRequestListener);
        apiClient.executeAsync(call, callback);
        return call;
    }
    /**
     * Build call for selectPsuAuthenticationMethod
     * @param consentId  (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 selectPsuAuthenticationMethodCall(String consentId, 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/consents/{consentId}/authorisations/{authorisationId}/selectPsuAuthenticationMethod"
            .replaceAll("\\{" + "consentId" + "\\}", apiClient.escapeString(consentId.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 selectPsuAuthenticationMethodValidateBeforeCall(String consentId, String authorisationId, SelectPsuAuthenticationMethodRequestTO body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'consentId' is set
        if (consentId == null) {
            throw new ApiException("Missing the required parameter 'consentId' when calling selectPsuAuthenticationMethod(Async)");
        }
        // verify the required parameter 'authorisationId' is set
        if (authorisationId == null) {
            throw new ApiException("Missing the required parameter 'authorisationId' when calling selectPsuAuthenticationMethod(Async)");
        }
        
        com.squareup.okhttp.Call call = selectPsuAuthenticationMethodCall(consentId, authorisationId, body, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * 
     * Update authorisation (select SCA method)
     * @param consentId  (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 selectPsuAuthenticationMethod(String consentId, String authorisationId, SelectPsuAuthenticationMethodRequestTO body) throws ApiException {
        ApiResponse resp = selectPsuAuthenticationMethodWithHttpInfo(consentId, authorisationId, body);
        return resp.getData();
    }

    /**
     * 
     * Update authorisation (select SCA method)
     * @param consentId  (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 selectPsuAuthenticationMethodWithHttpInfo(String consentId, String authorisationId, SelectPsuAuthenticationMethodRequestTO body) throws ApiException {
        com.squareup.okhttp.Call call = selectPsuAuthenticationMethodValidateBeforeCall(consentId, authorisationId, body, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * Update authorisation (select SCA method)
     * @param consentId  (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 selectPsuAuthenticationMethodAsync(String consentId, 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 = selectPsuAuthenticationMethodValidateBeforeCall(consentId, authorisationId, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for transactionAuthorisation
     * @param consentId  (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 transactionAuthorisationCall(String consentId, 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/consents/{consentId}/authorisations/{authorisationId}/transactionAuthorisation"
            .replaceAll("\\{" + "consentId" + "\\}", apiClient.escapeString(consentId.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 transactionAuthorisationValidateBeforeCall(String consentId, String authorisationId, TransactionAuthorisationRequestTO body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'consentId' is set
        if (consentId == null) {
            throw new ApiException("Missing the required parameter 'consentId' when calling transactionAuthorisation(Async)");
        }
        // verify the required parameter 'authorisationId' is set
        if (authorisationId == null) {
            throw new ApiException("Missing the required parameter 'authorisationId' when calling transactionAuthorisation(Async)");
        }
        
        com.squareup.okhttp.Call call = transactionAuthorisationCall(consentId, authorisationId, body, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * 
     * Update authorisation (authorize transaction)
     * @param consentId  (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 transactionAuthorisation(String consentId, String authorisationId, TransactionAuthorisationRequestTO body) throws ApiException {
        ApiResponse resp = transactionAuthorisationWithHttpInfo(consentId, authorisationId, body);
        return resp.getData();
    }

    /**
     * 
     * Update authorisation (authorize transaction)
     * @param consentId  (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 transactionAuthorisationWithHttpInfo(String consentId, String authorisationId, TransactionAuthorisationRequestTO body) throws ApiException {
        com.squareup.okhttp.Call call = transactionAuthorisationValidateBeforeCall(consentId, authorisationId, body, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * Update authorisation (authorize transaction)
     * @param consentId  (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 transactionAuthorisationAsync(String consentId, 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 = transactionAuthorisationValidateBeforeCall(consentId, authorisationId, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for updatePsuAuthentication
     * @param consentId  (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 updatePsuAuthenticationCall(String consentId, 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/consents/{consentId}/authorisations/{authorisationId}/updatePsuAuthentication"
            .replaceAll("\\{" + "consentId" + "\\}", apiClient.escapeString(consentId.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 updatePsuAuthenticationValidateBeforeCall(String consentId, String authorisationId, UpdatePsuAuthenticationRequestTO body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'consentId' is set
        if (consentId == null) {
            throw new ApiException("Missing the required parameter 'consentId' when calling updatePsuAuthentication(Async)");
        }
        // verify the required parameter 'authorisationId' is set
        if (authorisationId == null) {
            throw new ApiException("Missing the required parameter 'authorisationId' when calling updatePsuAuthentication(Async)");
        }
        
        com.squareup.okhttp.Call call = updatePsuAuthenticationCall(consentId, authorisationId, body, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * 
     * Update authorisation (authenticate user)
     * @param consentId  (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 updatePsuAuthentication(String consentId, String authorisationId, UpdatePsuAuthenticationRequestTO body) throws ApiException {
        ApiResponse resp = updatePsuAuthenticationWithHttpInfo(consentId, authorisationId, body);
        return resp.getData();
    }

    /**
     * 
     * Update authorisation (authenticate user)
     * @param consentId  (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 updatePsuAuthenticationWithHttpInfo(String consentId, String authorisationId, UpdatePsuAuthenticationRequestTO body) throws ApiException {
        com.squareup.okhttp.Call call = updatePsuAuthenticationValidateBeforeCall(consentId, authorisationId, body, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * Update authorisation (authenticate user)
     * @param consentId  (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 updatePsuAuthenticationAsync(String consentId, 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 = updatePsuAuthenticationValidateBeforeCall(consentId, authorisationId, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy