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

com.truelayer.java.mandates.IMandatesApi Maven / Gradle / Ivy

There is a newer version: 16.0.0
Show newest version
package com.truelayer.java.mandates;

import com.truelayer.java.entities.RequestScopes;
import com.truelayer.java.http.entities.ApiResponse;
import com.truelayer.java.mandates.entities.*;
import com.truelayer.java.mandates.entities.mandatedetail.MandateDetail;
import com.truelayer.java.payments.entities.AuthorizationFlowResponse;
import com.truelayer.java.payments.entities.StartAuthorizationFlowRequest;
import com.truelayer.java.payments.entities.SubmitProviderSelectionRequest;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import retrofit2.http.*;

/**
 * Exposes all the mandates related capabilities of the library.
 *
 * @see Mandates API reference
 */
public interface IMandatesApi {

    /**
     * Create a new mandate
     * @param scopes the scopes to be used by the underlying Oauth token
     * @param headers map representing custom HTTP headers to be sent
     * @param request the create mandate request
     * @return the created mandate
     * @see Create mandate API reference
     */
    @POST("/mandates")
    CompletableFuture> createMandate(
            @Tag RequestScopes scopes, @HeaderMap Map headers, @Body CreateMandateRequest request);

    /**
     * Start the authorization flow for a mandate.
     * @param scopes the scopes to be used by the underlying Oauth token
     * @param headers map representing custom HTTP headers to be sent
     * @param mandateId the id of the mandate
     * @param request the start authorization flow request
     * @return the mandate authorization flow created
     * @see Start authorization flow API reference
     */
    @POST("/mandates/{id}/authorization-flow")
    CompletableFuture> startAuthorizationFlow(
            @Tag RequestScopes scopes,
            @HeaderMap Map headers,
            @Path("id") String mandateId,
            @Body StartAuthorizationFlowRequest request);

    /**
     * Submit the provider details selected by the PSU
     * @param scopes the scopes to be used by the underlying Oauth token
     * @param headers map representing custom HTTP headers to be sent
     * @param mandateId the id of the mandate
     * @param request the provider selection request
     * @return the next action to take care of
     * @see Submit provider selection API reference
     */
    @POST("/mandates/{id}/authorization-flow/actions/provider-selection")
    CompletableFuture> submitProviderSelection(
            @Tag RequestScopes scopes,
            @HeaderMap Map headers,
            @Path("id") String mandateId,
            @Body SubmitProviderSelectionRequest request);

    /**
     * List all the mandates associated to the client used
     * @param scopes the scopes to be used by the underlying Oauth token
     * @param userId optional query parameters to only fetch mandates belonging to a particular user
     * @param cursor cursor used for pagination purposes that represents the first item of the page
     * @param limit maximum number of items included in a returned page
     * @return the list of mandates matching the given criteria
     * @see List mandates API reference
     */
    @GET("/mandates")
    CompletableFuture> listMandates(
            @Tag RequestScopes scopes,
            @Query("user_id") String userId,
            @Query("cursor") String cursor,
            @Query("limit") Integer limit);

    /**
     * Get mandate
     * @param scopes the scopes to be used by the underlying Oauth token
     * @param mandateId the id of the mandate
     * @return the mandate matching the given id
     * @see Get mandate API reference
     */
    @GET("/mandates/{id}")
    CompletableFuture> getMandate(@Tag RequestScopes scopes, @Path("id") String mandateId);

    /**
     * Revoke mandate
     * @param scopes the scopes to be used by the underlying Oauth token
     * @param headers map representing custom HTTP headers to be sent
     * @param mandateId the id of the mandate
     * @return an empty response in case of success
     * @see Revoke mandate API reference
     */
    @POST("/mandates/{id}/revoke")
    CompletableFuture> revokeMandate(
            @Tag RequestScopes scopes, @HeaderMap Map headers, @Path("id") String mandateId);

    /**
     * Get Confirmation Of Funds
     * @param scopes the scopes to be used by the underlying Oauth token
     * @param mandateId the id of the mandate
     * @param amount_in_minor the amount to be confirmed present in the bank account
     * @param currency the currency of the mandate
     * @return a boolean representing funds availability and the time this was checked
     * @see Funds Confirmation API reference
     */
    @GET("/mandates/{id}/funds?")
    CompletableFuture> getConfirmationOfFunds(
            @Tag RequestScopes scopes,
            @Path("id") String mandateId,
            @Query("amount_in_minor") String amount_in_minor,
            @Query("currency") String currency);

    /**
     * Get Mandate Constraints
     * @param scopes the scopes to be used by the underlying Oauth token
     * @param mandateId the id of the mandate
     * @return the current status of the mandate constraints
     * @see Get Mandate Constraints API reference
     */
    @GET("/mandates/{id}/constraints")
    CompletableFuture> getMandateConstraints(
            @Tag RequestScopes scopes, @Path("id") String mandateId);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy