2025-11-05 15:47:06 +09:00
|
|
|
import { apiClient, getDataOrThrow } from "@/lib/api";
|
|
|
|
|
import type { WhmcsCurrency } from "@customer-portal/domain/billing";
|
2025-10-20 13:53:35 +09:00
|
|
|
|
2025-11-05 15:47:06 +09:00
|
|
|
export const FALLBACK_CURRENCY: WhmcsCurrency = {
|
|
|
|
|
id: 1,
|
|
|
|
|
code: "JPY",
|
|
|
|
|
prefix: "¥",
|
|
|
|
|
suffix: "",
|
|
|
|
|
format: "1",
|
|
|
|
|
rate: "1.00000",
|
|
|
|
|
};
|
2025-10-20 13:53:35 +09:00
|
|
|
|
2025-11-05 15:47:06 +09:00
|
|
|
export const currencyService = {
|
|
|
|
|
async getDefaultCurrency(): Promise<WhmcsCurrency> {
|
|
|
|
|
const response = await apiClient.GET<WhmcsCurrency>("/api/currency/default");
|
|
|
|
|
return getDataOrThrow(response, "Failed to get default currency");
|
|
|
|
|
},
|
2025-10-20 13:53:35 +09:00
|
|
|
|
2025-11-05 15:47:06 +09:00
|
|
|
async getAllCurrencies(): Promise<WhmcsCurrency[]> {
|
|
|
|
|
const response = await apiClient.GET<WhmcsCurrency[]>("/api/currency/all");
|
|
|
|
|
return getDataOrThrow(response, "Failed to get currencies");
|
|
|
|
|
},
|
|
|
|
|
};
|