Implement new billing-gateway and update related services
Created a new package named billing-gateway which implements interfaces for different billing providers and provides a centralized service for payments. This will potentially help to maintain cleaner code by reducing direct dependencies on specific payment providers in the core application code. Additionally, made adjustments in existing services, like Stripe, to comply with this change. The relevant interfaces and types have been exported and imported accordingly.
This commit is contained in:
@@ -6,19 +6,15 @@ import 'server-only';
|
||||
import { Database } from '../database.types';
|
||||
import { getSupabaseClientKeys } from '../get-supabase-client-keys';
|
||||
|
||||
const createServerSupabaseClient = <GenericSchema = Database>() => {
|
||||
const createServerSupabaseClient = () => {
|
||||
const keys = getSupabaseClientKeys();
|
||||
|
||||
return createServerClient<GenericSchema>(keys.url, keys.anonKey, {
|
||||
return createServerClient<Database>(keys.url, keys.anonKey, {
|
||||
cookies: getCookiesStrategy(),
|
||||
});
|
||||
};
|
||||
|
||||
export const getSupabaseServerActionClient = <
|
||||
GenericSchema = Database,
|
||||
>(params?: {
|
||||
admin: false;
|
||||
}) => {
|
||||
export const getSupabaseServerActionClient = (params?: { admin: false }) => {
|
||||
const keys = getSupabaseClientKeys();
|
||||
const admin = params?.admin ?? false;
|
||||
|
||||
@@ -35,7 +31,7 @@ export const getSupabaseServerActionClient = <
|
||||
throw new Error('Supabase Service Role Key not provided');
|
||||
}
|
||||
|
||||
return createServerClient<GenericSchema>(keys.url, serviceRoleKey, {
|
||||
return createServerClient<Database>(keys.url, serviceRoleKey, {
|
||||
auth: {
|
||||
persistSession: false,
|
||||
},
|
||||
@@ -43,7 +39,7 @@ export const getSupabaseServerActionClient = <
|
||||
});
|
||||
}
|
||||
|
||||
return createServerSupabaseClient<GenericSchema>();
|
||||
return createServerSupabaseClient();
|
||||
};
|
||||
|
||||
function getCookiesStrategy() {
|
||||
|
||||
Reference in New Issue
Block a user