mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 08:46:22 +02:00
34 lines
963 B
TypeScript
34 lines
963 B
TypeScript
import {
|
|
type CreateCheckoutSessionRequest,
|
|
type CreateCheckoutSessionResponse,
|
|
createCheckoutSessionResponse,
|
|
type GetPagePurchasesResponse,
|
|
getPagePurchasesResponse,
|
|
type StripeStatusResponse,
|
|
stripeStatusResponse,
|
|
} from "@/contracts/types/stripe.types";
|
|
import { baseApiService } from "./base-api.service";
|
|
|
|
class StripeApiService {
|
|
createCheckoutSession = async (
|
|
request: CreateCheckoutSessionRequest
|
|
): Promise<CreateCheckoutSessionResponse> => {
|
|
return baseApiService.post(
|
|
"/api/v1/stripe/create-checkout-session",
|
|
createCheckoutSessionResponse,
|
|
{
|
|
body: request,
|
|
}
|
|
);
|
|
};
|
|
|
|
getPurchases = async (): Promise<GetPagePurchasesResponse> => {
|
|
return baseApiService.get("/api/v1/stripe/purchases", getPagePurchasesResponse);
|
|
};
|
|
|
|
getStatus = async (): Promise<StripeStatusResponse> => {
|
|
return baseApiService.get("/api/v1/stripe/status", stripeStatusResponse);
|
|
};
|
|
}
|
|
|
|
export const stripeApiService = new StripeApiService();
|