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

com.univapay.sdk.resources.SubscriptionsResource Maven / Gradle / Ivy

There is a newer version: 0.2.35
Show newest version
package com.univapay.sdk.resources;

import com.univapay.sdk.constants.UnivapayConstants;
import com.univapay.sdk.models.common.*;
import com.univapay.sdk.models.common.ChargeId;
import com.univapay.sdk.models.common.IdempotencyKey;
import com.univapay.sdk.models.common.ScheduledPaymentId;
import com.univapay.sdk.models.common.StoreId;
import com.univapay.sdk.models.common.SubscriptionId;
import com.univapay.sdk.models.common.Void;
import com.univapay.sdk.models.request.subscription.ScheduledPaymentPatchData;
import com.univapay.sdk.models.request.subscription.SubscriptionCreateData;
import com.univapay.sdk.models.request.subscription.SubscriptionPlanSimulationRequest;
import com.univapay.sdk.models.request.subscription.SubscriptionUpdateData;
import com.univapay.sdk.models.response.PaginatedList;
import com.univapay.sdk.models.response.PaymentsPlan;
import com.univapay.sdk.models.response.charge.Charge;
import com.univapay.sdk.models.response.subscription.FullSubscription;
import com.univapay.sdk.models.response.subscription.ScheduledPayment;
import com.univapay.sdk.models.response.subscription.Subscription;
import com.univapay.sdk.types.CursorDirection;
import org.jetbrains.annotations.Nullable;
import retrofit2.Call;
import retrofit2.http.*;

/** Resource for managing subscriptions. */
public interface SubscriptionsResource {
  @GET("/subscriptions")
  Call> listAllSubscriptions(
      @Query("limit") @Nullable Integer limit,
      @Query("cursor_direction") @Nullable CursorDirection cursorDirection,
      @Query("cursor") @Nullable SubscriptionId cursor);

  @GET("/stores/{storeId}/subscriptions")
  Call> listAllSubscriptions(
      @Path("storeId") StoreId storeId,
      @Query("limit") @Nullable Integer limit,
      @Query("cursor_direction") @Nullable CursorDirection cursorDirection,
      @Query("cursor") @Nullable SubscriptionId cursor);

  @GET("/stores/{storeId}/subscriptions/{subscriptionId}")
  Call getSubscription(
      @Path("storeId") StoreId storeId,
      @Path("subscriptionId") SubscriptionId subscriptionId,
      @Query("polling") @Nullable Boolean polling);

  @POST("/subscriptions")
  Call createSubscription(
      @Body SubscriptionCreateData dataToPost,
      @Header(UnivapayConstants.idempotencyKeyHeaderName) IdempotencyKey idempotencyKey);

  @PATCH("/stores/{storeId}/subscriptions/{subscriptionId}")
  Call updateSubscription(
      @Path("storeId") StoreId storeId,
      @Path("subscriptionId") SubscriptionId subscriptionId,
      @Body SubscriptionUpdateData dataToPost,
      @Header(UnivapayConstants.idempotencyKeyHeaderName) IdempotencyKey idempotencyKey);

  @GET("/stores/{storeId}/subscriptions/{subscriptionId}/payments")
  Call> listPayments(
      @Path("storeId") StoreId storeId,
      @Path("subscriptionId") SubscriptionId subscriptionId,
      @Query("limit") @Nullable Integer limit,
      @Query("cursor_direction") @Nullable CursorDirection cursorDirection,
      @Query("cursor") @Nullable ScheduledPaymentId cursor);

  @GET("/stores/{storeId}/subscriptions/{subscriptionId}/payments/{paymentId}")
  Call getPayment(
      @Path("storeId") StoreId storeId,
      @Path("subscriptionId") SubscriptionId subscriptionId,
      @Path("paymentId") ScheduledPaymentId paymentId);

  @GET("/stores/{storeId}/subscriptions/{subscriptionId}/payments/{paymentId}/charges")
  Call> listChargesForPayment(
      @Path("storeId") StoreId storeId,
      @Path("subscriptionId") SubscriptionId subscriptionId,
      @Path("paymentId") ScheduledPaymentId paymentId,
      @Query("limit") @Nullable Integer limit,
      @Query("cursor_direction") @Nullable CursorDirection cursorDirection,
      @Query("cursor") @Nullable ChargeId cursor);

  @PATCH("/stores/{storeId}/subscriptions/{subscriptionId}/payments/{paymentId}")
  Call updatePayment(
      @Path("storeId") StoreId storeId,
      @Path("subscriptionId") SubscriptionId subscriptionId,
      @Path("paymentId") ScheduledPaymentId paymentId,
      @Body ScheduledPaymentPatchData patchData,
      @Header(UnivapayConstants.idempotencyKeyHeaderName) IdempotencyKey idempotencyKey);

  @DELETE("/stores/{storeId}/subscriptions/{subscriptionId}")
  Call deleteSubscription(
      @Path("storeId") StoreId storeId, @Path("subscriptionId") SubscriptionId subscriptionId);

  @GET("/stores/{storeId}/subscriptions/{subscriptionId}/charges")
  Call> listSubscriptionCharges(
      @Path("storeId") StoreId storeId,
      @Path("subscriptionId") SubscriptionId subscriptionId,
      @Query("limit") @Nullable Integer limit,
      @Query("cursor_direction") @Nullable CursorDirection cursorDirection,
      @Query("cursor") @Nullable ChargeId cursor);

  @POST("/subscriptions/simulate_plan")
  Call simulateSubscriptionPlan(
      @Body SubscriptionPlanSimulationRequest simulationRequest,
      @Header(UnivapayConstants.idempotencyKeyHeaderName) IdempotencyKey idempotencyKey);

  @POST("/stores/{storeId}/subscriptions/simulate_plan")
  Call simulateSubscriptionPlan(
      @Path("storeId") StoreId storeId,
      @Body SubscriptionPlanSimulationRequest simulationRequest,
      @Header(UnivapayConstants.idempotencyKeyHeaderName) IdempotencyKey idempotencyKey);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy