content: /*
   * Adyen Checkout API
   *
   * The version of the OpenAPI document: 71
   *
   *
   * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
   * https://openapi-generator.tech
   * Do not edit the class manually.
   */
  
  package com.adyen.service.checkout;
  
  import com.adyen.Client;
  import com.adyen.Service;
  import com.adyen.constants.ApiConstants;
  import com.adyen.model.RequestOptions;
  import com.adyen.model.checkout.ApplePaySessionRequest;
  import com.adyen.model.checkout.ApplePaySessionResponse;
  import com.adyen.model.checkout.PaypalUpdateOrderRequest;
  import com.adyen.model.checkout.PaypalUpdateOrderResponse;
  import com.adyen.model.checkout.UtilityRequest;
  import com.adyen.model.checkout.UtilityResponse;
  import com.adyen.model.checkout.ValidateShopperIdRequest;
  import com.adyen.model.checkout.ValidateShopperIdResponse;
  import com.adyen.service.exception.ApiException;
  import com.adyen.service.resource.Resource;
  import java.io.IOException;
  
  public class UtilityApi extends Service {
  
    public static final String API_VERSION = "71";
  
    protected String baseURL;
  
    /**
     * Utility constructor in {@link com.adyen.service.checkout package}.
     *
     * @param client {@link Client } (required)
     */
    public UtilityApi(Client client) {
      super(client);
      this.baseURL = createBaseURL("https://checkout-test.adyen.com/v71");
    }
  
    /**
     * Utility constructor in {@link com.adyen.service.checkout package}. Please use this constructor
     * only if you would like to pass along your own url for routing or testing purposes. The latest
     * API version is defined in this class as a constant.
     *
     * @param client {@link Client } (required)
     * @param baseURL {@link String } (required)
     */
    public UtilityApi(Client client, String baseURL) {
      super(client);
      this.baseURL = baseURL;
    }
  
    /**
     * Get an Apple Pay session
     *
     * @param applePaySessionRequest {@link ApplePaySessionRequest } (required)
     * @return {@link ApplePaySessionResponse }
     * @throws ApiException if fails to make API call
     */
    public ApplePaySessionResponse getApplePaySession(ApplePaySessionRequest applePaySessionRequest)
        throws ApiException, IOException {
      return getApplePaySession(applePaySessionRequest, null);
    }
  
    /**
     * Get an Apple Pay session
     *
     * @param applePaySessionRequest {@link ApplePaySessionRequest } (required)
     * @param requestOptions {@link RequestOptions } Object to store additional data such as
     *     idempotency-keys (optional)
     * @return {@link ApplePaySessionResponse }
     * @throws ApiException if fails to make API call
     */
    public ApplePaySessionResponse getApplePaySession(
        ApplePaySessionRequest applePaySessionRequest, RequestOptions requestOptions)
        throws ApiException, IOException {
      String requestBody = applePaySessionRequest.toJson();
      Resource resource = new Resource(this, this.baseURL + "/applePay/sessions", null);
      String jsonResult =
          resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, null);
      return ApplePaySessionResponse.fromJson(jsonResult);
    }
  
    /**
     * Create originKey values for domains
     *
     * @param utilityRequest {@link UtilityRequest } (required)
     * @return {@link UtilityResponse }
     * @throws ApiException if fails to make API call
     * @deprecated since Adyen Checkout API v67
     */
    @Deprecated
    public UtilityResponse originKeys(UtilityRequest utilityRequest)
        throws ApiException, IOException {
      return originKeys(utilityRequest, null);
    }
  
    /**
     * Create originKey values for domains
     *
     * @param utilityRequest {@link UtilityRequest } (required)
     * @param requestOptions {@link RequestOptions } Object to store additional data such as
     *     idempotency-keys (optional)
     * @return {@link UtilityResponse }
     * @throws ApiException if fails to make API call
     * @deprecated since Adyen Checkout API v67
     */
    @Deprecated
    public UtilityResponse originKeys(UtilityRequest utilityRequest, RequestOptions requestOptions)
        throws ApiException, IOException {
      String requestBody = utilityRequest.toJson();
      Resource resource = new Resource(this, this.baseURL + "/originKeys", null);
      String jsonResult =
          resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, null);
      return UtilityResponse.fromJson(jsonResult);
    }
  
    /**
     * Updates the order for PayPal Express Checkout
     *
     * @param paypalUpdateOrderRequest {@link PaypalUpdateOrderRequest } (required)
     * @return {@link PaypalUpdateOrderResponse }
     * @throws ApiException if fails to make API call
     */
    public PaypalUpdateOrderResponse updatesOrderForPaypalExpressCheckout(
        PaypalUpdateOrderRequest paypalUpdateOrderRequest) throws ApiException, IOException {
      return updatesOrderForPaypalExpressCheckout(paypalUpdateOrderRequest, null);
    }
  
    /**
     * Updates the order for PayPal Express Checkout
     *
     * @param paypalUpdateOrderRequest {@link PaypalUpdateOrderRequest } (required)
     * @param requestOptions {@link RequestOptions } Object to store additional data such as
     *     idempotency-keys (optional)
     * @return {@link PaypalUpdateOrderResponse }
     * @throws ApiException if fails to make API call
     */
    public PaypalUpdateOrderResponse updatesOrderForPaypalExpressCheckout(
        PaypalUpdateOrderRequest paypalUpdateOrderRequest, RequestOptions requestOptions)
        throws ApiException, IOException {
      String requestBody = paypalUpdateOrderRequest.toJson();
      Resource resource = new Resource(this, this.baseURL + "/paypal/updateOrder", null);
      String jsonResult =
          resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, null);
      return PaypalUpdateOrderResponse.fromJson(jsonResult);
    }
  
    /**
     * Validates shopper Id
     *
     * @param validateShopperIdRequest {@link ValidateShopperIdRequest } (required)
     * @param validateShopperIdRequest {@link ValidateShopperIdRequest } (required)
     * @return {@link ValidateShopperIdResponse }
     * @throws ApiException if fails to make API call
     */
    public ValidateShopperIdResponse validateShopperId(
        ValidateShopperIdRequest validateShopperIdRequest) throws ApiException, IOException {
      return validateShopperId(validateShopperIdRequest, null);
    }
  
    /**
     * Validates shopper Id
     *
     * @param validateShopperIdRequest {@link ValidateShopperIdRequest } (required)
     * @param requestOptions {@link RequestOptions } Object to store additional data such as
     *     idempotency-keys (optional)
     * @return {@link ValidateShopperIdResponse }
     * @throws ApiException if fails to make API call
     */
    public ValidateShopperIdResponse validateShopperId(
        ValidateShopperIdRequest validateShopperIdRequest, RequestOptions requestOptions)
        throws ApiException, IOException {
      String requestBody = validateShopperIdRequest.toJson();
      Resource resource = new Resource(this, this.baseURL + "/validateShopperId", null);
      String jsonResult =
          resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, null);
      return ValidateShopperIdResponse.fromJson(jsonResult);
    }
  }
  