All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.adyen.service.Checkout Maven / Gradle / Ivy
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Java API Library
*
* Copyright (c) 2020 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
package com.adyen.service;
import com.adyen.ApiKeyAuthenticatedService;
import com.adyen.Client;
import com.adyen.model.RequestOptions;
import com.adyen.model.checkout.CreatePaymentLinkRequest;
import com.adyen.model.checkout.CreatePaymentLinkResponse;
import com.adyen.model.checkout.PaymentMethodsRequest;
import com.adyen.model.checkout.PaymentMethodsResponse;
import com.adyen.model.checkout.PaymentResultRequest;
import com.adyen.model.checkout.PaymentResultResponse;
import com.adyen.model.checkout.PaymentSessionRequest;
import com.adyen.model.checkout.PaymentSessionResponse;
import com.adyen.model.checkout.PaymentsDetailsRequest;
import com.adyen.model.checkout.PaymentsRequest;
import com.adyen.model.checkout.PaymentsResponse;
import com.adyen.model.checkout.CheckoutCreateOrderRequest;
import com.adyen.model.checkout.CheckoutCreateOrderResponse;
import com.adyen.model.checkout.CheckoutCancelOrderRequest;
import com.adyen.model.checkout.CheckoutCancelOrderResponse;
import com.adyen.model.checkout.CreateStoredPaymentMethodRequest;
import com.adyen.model.checkout.StoredPaymentMethodResource;
import com.adyen.service.exception.ApiException;
import com.adyen.service.resource.checkout.PaymentLinks;
import com.adyen.service.resource.checkout.PaymentMethods;
import com.adyen.service.resource.checkout.PaymentSession;
import com.adyen.service.resource.checkout.Payments;
import com.adyen.service.resource.checkout.PaymentsDetails;
import com.adyen.service.resource.checkout.PaymentsResult;
import com.adyen.service.resource.checkout.Orders;
import com.adyen.service.resource.checkout.OrdersCancel;
import com.adyen.service.resource.checkout.StoredPaymentsMethods;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
public class Checkout extends ApiKeyAuthenticatedService {
private Payments payments;
private PaymentMethods paymentMethods;
private PaymentsDetails paymentsDetails;
private PaymentSession paymentSession;
private PaymentsResult paymentsResult;
private PaymentLinks paymentLinks;
private Orders orders;
private OrdersCancel ordersCancel;
private StoredPaymentsMethods storedPaymentsMethods;
public Checkout(Client client) {
super(client);
payments = new Payments(this);
paymentMethods = new PaymentMethods(this);
paymentsDetails = new PaymentsDetails(this);
paymentSession = new PaymentSession(this);
paymentsResult = new PaymentsResult(this);
paymentLinks = new PaymentLinks(this);
orders = new Orders(this);
ordersCancel = new OrdersCancel(this);
storedPaymentsMethods = new StoredPaymentsMethods(this);
}
/**
* POST /payments API call
*
* @param paymentsRequest PaymentsRequest
* @return paymentsResponse
* @throws IOException IOException
* @throws ApiException ApiException
*/
public PaymentsResponse payments(PaymentsRequest paymentsRequest) throws ApiException, IOException {
return payments(paymentsRequest, null);
}
public PaymentsResponse payments(PaymentsRequest paymentsRequest, RequestOptions requestOptions) throws ApiException, IOException {
String jsonRequest = GSON.toJson(paymentsRequest);
String jsonResult = payments.request(jsonRequest, requestOptions);
return GSON.fromJson(jsonResult, new TypeToken() {
}.getType());
}
/**
* POST /paymentMethods API call
*
* @param paymentMethodsRequest PaymentMethodsRequest
* @return paymentMethodsResponse PaymentMethodsResponse
* @throws IOException IOException
* @throws ApiException ApiException
*/
public PaymentMethodsResponse paymentMethods(PaymentMethodsRequest paymentMethodsRequest) throws ApiException, IOException {
String jsonRequest = GSON.toJson(paymentMethodsRequest);
String jsonResult = paymentMethods.request(jsonRequest);
return GSON.fromJson(jsonResult, new TypeToken() {
}.getType());
}
/**
* POST payments/details API call
*
* @param paymentsDetailsRequest paymentsDetailsRequest
* @return paymentsResponse paymentsResponse
* @throws IOException IOException
* @throws ApiException ApiException
*/
public PaymentsResponse paymentsDetails(PaymentsDetailsRequest paymentsDetailsRequest) throws ApiException, IOException {
return paymentsDetails(paymentsDetailsRequest, null);
}
public PaymentsResponse paymentsDetails(PaymentsDetailsRequest paymentsDetailsRequest, RequestOptions requestOptions) throws ApiException, IOException {
String jsonRequest = GSON.toJson(paymentsDetailsRequest);
String jsonResult = paymentsDetails.request(jsonRequest, requestOptions);
return GSON.fromJson(jsonResult, new TypeToken() {
}.getType());
}
/**
* POST /paymentSession API call
*
* @param paymentSessionRequest paymentSessionRequest
* @return paymentSessionResponse
* @throws IOException IOException
* @throws ApiException ApiException
*/
public PaymentSessionResponse paymentSession(PaymentSessionRequest paymentSessionRequest) throws ApiException, IOException {
return paymentSession(paymentSessionRequest, null);
}
public PaymentSessionResponse paymentSession(PaymentSessionRequest paymentSessionRequest, RequestOptions requestOptions) throws ApiException, IOException {
String jsonRequest = GSON.toJson(paymentSessionRequest);
String jsonResult = paymentSession.request(jsonRequest, requestOptions);
return GSON.fromJson(jsonResult, new TypeToken() {
}.getType());
}
/**
* POST payments/result API call
*
* @param paymentResultRequest paymentResultRequest
* @return paymentResultResponse
* @throws IOException IOException
* @throws ApiException ApiException
*/
public PaymentResultResponse paymentResult(PaymentResultRequest paymentResultRequest) throws ApiException, IOException {
String jsonRequest = GSON.toJson(paymentResultRequest);
String jsonResult = paymentsResult.request(jsonRequest);
return GSON.fromJson(jsonResult, new TypeToken() {
}.getType());
}
/**
* POST /paymentLinks API call
*
* @param createPaymentLinkRequest CreatePaymentLinkRequest
* @return createPaymentLinkResponse
* @throws IOException IOException
* @throws ApiException ApiException
*/
public CreatePaymentLinkResponse paymentLinks(CreatePaymentLinkRequest createPaymentLinkRequest) throws ApiException, IOException {
String jsonRequest = GSON.toJson(createPaymentLinkRequest);
String jsonResult = paymentLinks.request(jsonRequest);
return GSON.fromJson(jsonResult, new TypeToken() {
}.getType());
}
/**
* POST /storedPaymentMethods API call
*
* @param createStoredPaymentMethodRequest StoredPaymentMethodsRequest
* @return storedPaymentMethod
* @throws IOException IOException
* @throws ApiException ApiException
*/
public StoredPaymentMethodResource storedPaymentMethods(CreateStoredPaymentMethodRequest createStoredPaymentMethodRequest) throws ApiException, IOException {
String jsonRequest = GSON.toJson(createStoredPaymentMethodRequest);
String jsonResult = storedPaymentsMethods.request(jsonRequest);
return GSON.fromJson(jsonResult, new TypeToken() {
}.getType());
}
/**
* POST /orders API call
*
* @param checkoutCreateOrderRequest CheckoutCreateOrderRequest
* @return
* @throws ApiException
* @throws IOException
*/
public CheckoutCreateOrderResponse orders(CheckoutCreateOrderRequest checkoutCreateOrderRequest) throws ApiException, IOException {
String jsonRequest = GSON.toJson(checkoutCreateOrderRequest);
String jsonResult = orders.request(jsonRequest);
return GSON.fromJson(jsonResult, new TypeToken() {
}.getType());
}
/**
* POST /orders/cancel API call
*
* @param checkoutCancelOrderRequest CheckoutCancelOrderRequest
* @return
* @throws ApiException
* @throws IOException
*/
public CheckoutCancelOrderResponse ordersCancel(CheckoutCancelOrderRequest checkoutCancelOrderRequest) throws ApiException, IOException {
String jsonRequest = GSON.toJson(checkoutCancelOrderRequest);
String jsonResult = ordersCancel.request(jsonRequest);
return GSON.fromJson(jsonResult, new TypeToken() {
}.getType());
}
}