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

jp.gopay.sdk.resources.SubscriptionsResource Maven / Gradle / Ivy

There is a newer version: 0.11.17
Show newest version
package jp.gopay.sdk.resources;

import jp.gopay.sdk.models.common.*;
import jp.gopay.sdk.models.common.Void;
import jp.gopay.sdk.models.request.subscription.ScheduledPaymentPatchData;
import jp.gopay.sdk.models.request.subscription.SubscriptionCreateData;
import jp.gopay.sdk.models.request.subscription.SubscriptionPlanSimulationRequest;
import jp.gopay.sdk.models.request.subscription.SubscriptionUpdateData;
import jp.gopay.sdk.models.response.PaginatedList;
import jp.gopay.sdk.models.response.PaymentsPlan;
import jp.gopay.sdk.models.response.charge.Charge;
import jp.gopay.sdk.models.response.subscription.FullSubscription;
import jp.gopay.sdk.models.response.subscription.ScheduledPayment;
import jp.gopay.sdk.models.response.subscription.Subscription;
import jp.gopay.sdk.types.CursorDirection;
import retrofit2.Call;
import retrofit2.http.*;

import javax.annotation.Nullable;

import static jp.gopay.sdk.constants.GopayConstants.idempotencyKeyHeaderName;

/**
 * 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(idempotencyKeyHeaderName) IdempotencyKey idempotencyKey
    );

    @PATCH("/stores/{storeId}/subscriptions/{subscriptionId}")
    Call updateSubscription(
            @Path("storeId") StoreId storeId,
            @Path("subscriptionId") SubscriptionId subscriptionId,
            @Body SubscriptionUpdateData dataToPost,
            @Header(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(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(idempotencyKeyHeaderName) IdempotencyKey idempotencyKey
    );

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy