This commit is contained in:
Iliyan Angelov
2025-11-17 18:26:30 +02:00
parent 48353cde9c
commit 0c59fe1173
2535 changed files with 278997 additions and 2480 deletions

View File

@@ -0,0 +1,88 @@
import apiClient from './apiClient';
export interface PlatformCurrencyResponse {
status: string;
data: {
currency: string;
updated_at: string | null;
updated_by: string | null;
};
}
export interface UpdateCurrencyRequest {
currency: string;
}
export interface StripeSettingsResponse {
status: string;
data: {
stripe_secret_key: string;
stripe_publishable_key: string;
stripe_webhook_secret: string;
stripe_secret_key_masked: string;
stripe_webhook_secret_masked: string;
has_secret_key: boolean;
has_publishable_key: boolean;
has_webhook_secret: boolean;
updated_at?: string | null;
updated_by?: string | null;
};
message?: string;
}
export interface UpdateStripeSettingsRequest {
stripe_secret_key?: string;
stripe_publishable_key?: string;
stripe_webhook_secret?: string;
}
const systemSettingsService = {
/**
* Get platform currency (public endpoint)
*/
getPlatformCurrency: async (): Promise<PlatformCurrencyResponse> => {
const response = await apiClient.get<PlatformCurrencyResponse>(
'/api/admin/system-settings/currency'
);
return response.data;
},
/**
* Update platform currency (Admin only)
*/
updatePlatformCurrency: async (
currency: string
): Promise<PlatformCurrencyResponse> => {
const response = await apiClient.put<PlatformCurrencyResponse>(
'/api/admin/system-settings/currency',
{ currency }
);
return response.data;
},
/**
* Get Stripe settings (Admin only)
*/
getStripeSettings: async (): Promise<StripeSettingsResponse> => {
const response = await apiClient.get<StripeSettingsResponse>(
'/api/admin/system-settings/stripe'
);
return response.data;
},
/**
* Update Stripe settings (Admin only)
*/
updateStripeSettings: async (
settings: UpdateStripeSettingsRequest
): Promise<StripeSettingsResponse> => {
const response = await apiClient.put<StripeSettingsResponse>(
'/api/admin/system-settings/stripe',
settings
);
return response.data;
},
};
export default systemSettingsService;