Package com.duffel.sdk.api
Class PaymentsApi
java.lang.Object
com.duffel.sdk.api.PaymentsApi
@Generated(value="org.openapitools.codegen.languages.JavaClientCodegen",
date="2022-08-28T15:13:42.592945+07:00[Asia/Bangkok]")
public class PaymentsApi
extends Object
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<CreatePayment201Response>createPayment(String accept, String duffelVersion, CreatePaymentRequest createPaymentRequest, String acceptEncoding, String contentType) Create a payment Creates a payment for a `hold` order.reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<CreatePayment201Response>>createPaymentWithHttpInfo(String accept, String duffelVersion, CreatePaymentRequest createPaymentRequest, String acceptEncoding, String contentType) voidsetApiClient(ApiClient apiClient)
-
Constructor Details
-
PaymentsApi
public PaymentsApi() -
PaymentsApi
-
-
Method Details
-
getApiClient
-
setApiClient
-
createPayment
public reactor.core.publisher.Mono<CreatePayment201Response> createPayment(String accept, String duffelVersion, CreatePaymentRequest createPaymentRequest, String acceptEncoding, String contentType) throws org.springframework.web.reactive.function.client.WebClientResponseException Create a payment Creates a payment for a `hold` order. A `hold` order can be paid for up to the time limit indicated in `payment_required_by`, after which the space held for the order will be released and you will have to create a new order. Before paying, you should always get the latest price by [retrieving the order](/docs/api/orders/get-order-by-id) to minimise the risk that the price you have is different from the latest price. If the price for an order has changed from the time of booking and you pass in the old price, then you will get a validation error on the `amount` field with a `price_changed` code. The price of an order should only change if the order has no price guarantee or the price guarantee has expired (ie. `price_guaranteed_expires_at` is `null` or in the past). If you receive a `500 Internal Server Error` when trying to create a payment for a `hold` order, it may have still been created on the airline’s side. Please contact Duffel support before trying the request again. ### Validation errors | Field | Code | Description | | ---------- | ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `order_id` | `order_type_not_eligible_for_payment` | This order can't be paid for because it isn't a `hold` order. | `amount` | `payment_amount_does_not_match_order_amount` | The `amount` provided in the payment doesn't match the `total_amount` of the order. | | `currency` | `payment_currency_does_not_match_order_currency` | The `currency` provided in the payment doesn't match the `total_currency` of the order. | ### Invalid states This endpoint can return the following errors with a `type` of `invalid_state`, to indicate a reason that the order can't be paid for: * `already_paid`: The order you’re paying for has already been paid for. * `already_cancelled`: The order you’re attempting to pay for has been cancelled. * `past_payment_required_by_date`: The order’s `payment_required_by` date has elapsed. * `schedule_changed`: You can't pay for this order because it has been changed in some way on the airline's side. You should start again, creating a new order.201 - A payment
- Parameters:
accept- All responses from the API are in JSON format with UTF-8 encoding. An `Accept` header is required with every request.duffelVersion- You'll need to send a `Duffel-Version` header with each request so we know which version of the API you want to use. Currently, the only available API version is `beta`.createPaymentRequest- The createPaymentRequest parameteracceptEncoding- We recommend enabling compression for responses returned by the API, since they can be very large. To enable compression, send an `Accept-Encoding` header. You'll need to configure your HTTP client to decompress responses. Most clients will have this functionality built-in.contentType- All request bodies sent to the API should be in JSON format. A `Content-Type` header is required whenever you're sending a request body (i.e. for POST and PUT requests).- Returns:
- CreatePayment201Response
- Throws:
org.springframework.web.reactive.function.client.WebClientResponseException- if an error occurs while attempting to invoke the API
-
createPaymentWithHttpInfo
public reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<CreatePayment201Response>> createPaymentWithHttpInfo(String accept, String duffelVersion, CreatePaymentRequest createPaymentRequest, String acceptEncoding, String contentType) throws org.springframework.web.reactive.function.client.WebClientResponseException - Throws:
org.springframework.web.reactive.function.client.WebClientResponseException
-