com.truelayer.java.payments.IPaymentsApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truelayer-java Show documentation
Show all versions of truelayer-java Show documentation
TrueLayer Java SDK for https://truelayer.com
package com.truelayer.java.payments;
import com.truelayer.java.entities.EmptyRequestBody;
import com.truelayer.java.entities.RequestScopes;
import com.truelayer.java.http.entities.ApiResponse;
import com.truelayer.java.payments.entities.*;
import com.truelayer.java.payments.entities.paymentdetail.PaymentDetail;
import com.truelayer.java.payments.entities.paymentrefund.PaymentRefund;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import retrofit2.http.*;
/**
* Exposes all the payments related capabilities of the library.
*
* @see Payments API reference
*/
public interface IPaymentsApi {
/**
* Initialises a payment resource.
* @param scopes the scopes to be used by the underlying Oauth token
* @param headers map representing custom HTTP headers to be sent
* @param request a create payment request payload
* @return the response of the Create Payment operation
* @see Create Payment API reference
*/
@POST("/payments")
CompletableFuture> createPayment(
@Tag RequestScopes scopes, @HeaderMap Map headers, @Body CreatePaymentRequest request);
/**
* Gets a payment resource by id.
* @param scopes the scopes to be used by the underlying Oauth token
* @param paymentId the payment identifier
* @return the response of the Get Payment operation
* @see Get Payment API reference
*/
@GET("/payments/{id}")
CompletableFuture> getPayment(@Tag RequestScopes scopes, @Path("id") String paymentId);
/**
* Starts an authorization flow for a given payment resource.
* @param scopes the scopes to be used by the underlying Oauth token
* @param headers map representing custom HTTP headers to be sent
* @param paymentId the payment identifier
* @param request a start authorization flow request payload
* @return the response of the Start Authorization Flow operation
* @see Start Authorization Flow API reference
*/
@POST("/payments/{id}/authorization-flow")
CompletableFuture> startAuthorizationFlow(
@Tag RequestScopes scopes,
@HeaderMap Map headers,
@Path("id") String paymentId,
@Body StartAuthorizationFlowRequest request);
/**
* Submit the provider selection for a given payment resource.
* @param scopes the scopes to be used by the underlying Oauth token
* @param headers map representing custom HTTP headers to be sent
* @param paymentId the payment identifier
* @param request a submit provider selection request payload
* @return the response of the Submit Provider Selection operation
* @see Submit Provider Selection API reference
*/
@POST("/payments/{id}/authorization-flow/actions/provider-selection")
CompletableFuture> submitProviderSelection(
@Tag RequestScopes scopes,
@HeaderMap Map headers,
@Path("id") String paymentId,
@Body SubmitProviderSelectionRequest request);
/**
* Submit consent collected from the PSU for a given payment resource.
* @param scopes the scopes to be used by the underlying Oauth token
* @param headers map representing custom HTTP headers to be sent
* @param paymentId the payment identifier
* @param request a submit consent request payload
* @return the response of the Submit Consent operation
* @see Submit Consent API reference
*/
@POST("/payments/{id}/authorization-flow/actions/consent")
CompletableFuture> submitConsent(
@Tag RequestScopes scopes,
@HeaderMap Map headers,
@Path("id") String paymentId,
@Body EmptyRequestBody request);
/**
* Submit form inputs collected from the PSU for a given payment resource.
* @param scopes the scopes to be used by the underlying Oauth token
* @param headers map representing custom HTTP headers to be sent
* @param paymentId the payment identifier
* @param request a submit form request payload
* @return the response of the Submit Form operation
* @see Submit Form API reference
*/
@POST("/payments/{id}/authorization-flow/actions/form")
CompletableFuture> submitForm(
@Tag RequestScopes scopes,
@HeaderMap Map headers,
@Path("id") String paymentId,
@Body SubmitFormRequest request);
/**
* Refund a merchant account payment.
* @param scopes the scopes to be used by the underlying Oauth token
* @param headers map representing custom HTTP headers to be sent
* @param paymentId the payment identifier
* @param request a create refund request payload
* @return the response of the Create Payment Refund operation
* @see Create Payment Refund API reference
*/
@POST("/payments/{id}/refunds")
CompletableFuture> createPaymentRefund(
@Tag RequestScopes scopes,
@HeaderMap Map headers,
@Path("id") String paymentId,
@Body CreatePaymentRefundRequest request);
/**
* Returns all refunds of a payment.
* @param scopes the scopes to be used by the underlying Oauth token
* @param paymentId the payment identifier
* @return the response of the Get Payment Refunds operation
* @see Get Payment Refunds API reference
*/
@GET("/payments/{id}/refunds")
CompletableFuture> listPaymentRefunds(
@Tag RequestScopes scopes, @Path("id") String paymentId);
/**
* Returns refund details.
* @param scopes the scopes to be used by the underlying Oauth token
* @param paymentId the payment identifier
* @return the response of the Get Payment Refund operation
* @see Get Payment Refund API reference
*/
@GET("/payments/{paymentId}/refunds/{refundId}")
CompletableFuture> getPaymentRefundById(
@Tag RequestScopes scopes, @Path("paymentId") String paymentId, @Path("refundId") String refundId);
}