Add: - hipmi-note.md Fix: - app/(application)/(user)/donation/[id]/(transaction-flow)/[invoiceId]/failed.tsx - app/(application)/(user)/donation/[id]/(transaction-flow)/[invoiceId]/success.tsx - app/(application)/(user)/event/[id]/confirmation.tsx - app/(application)/(user)/investment/(tabs)/index.tsx - app/(application)/(user)/investment/(tabs)/my-holding.tsx - app/(application)/(user)/investment/[id]/(my-holding)/[id].tsx - app/(application)/(user)/investment/[id]/(transaction-flow)/failed.tsx - app/(application)/(user)/investment/[id]/(transaction-flow)/index.tsx - app/(application)/(user)/investment/[id]/(transaction-flow)/success.tsx - app/(application)/(user)/investment/[id]/investor.tsx - app/(application)/admin/investment/[id]/[status]/index.tsx - app/(application)/admin/investment/[id]/[status]/transaction-detail.tsx - app/(application)/admin/investment/[id]/list-of-investor.tsx - lib/dummy-data/investment/dummy-data-not-publish.ts - screens/Authentication/VerificationView.tsx - screens/Home/bottomFeatureSection.tsx - service/api-client/api-investment.ts ### No Issue
267 lines
5.0 KiB
TypeScript
267 lines
5.0 KiB
TypeScript
import { apiConfig } from "../api-config";
|
|
|
|
export async function apiInvestmentCreate({ data }: { data: any }) {
|
|
try {
|
|
const response = await apiConfig.post(`/mobile/investment`, {
|
|
data: data,
|
|
});
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiInvestmentGetByStatus({
|
|
authorId,
|
|
status,
|
|
}: {
|
|
authorId: string;
|
|
status: string;
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.get(
|
|
`/mobile/investment/${authorId}/${status}`
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiInvestmentGetOne({ id }: { id: string }) {
|
|
try {
|
|
const response = await apiConfig.get(`/mobile/investment/${id}`);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiInvestmentUpdateStatus({
|
|
id,
|
|
status,
|
|
}: {
|
|
id: string;
|
|
status: "publish" | "draft" | "review" | "reject";
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.put(`/mobile/investment/${id}/${status}`);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiInvestmentDelete({ id }: { id: string }) {
|
|
try {
|
|
const response = await apiConfig.delete(`/mobile/investment/${id}`);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiInvestmentUpdateData({
|
|
id,
|
|
data,
|
|
category,
|
|
}: {
|
|
id: string;
|
|
data: any;
|
|
category: "data" | "prospectus";
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.put(
|
|
`/mobile/investment/${id}?category=${category}`,
|
|
{
|
|
data: data,
|
|
}
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiInvestmentUpsertDocument({
|
|
id,
|
|
data,
|
|
}: {
|
|
id: string;
|
|
data: any;
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.post(`/mobile/investment/${id}/document`, {
|
|
data: data,
|
|
});
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiInvestmentGetDocument({
|
|
id,
|
|
category,
|
|
}: {
|
|
id: string;
|
|
category: "one-document" | "all-document";
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.get(
|
|
`/mobile/investment/${id}/document?category=${category}`
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiInvestmentDeleteDocument({ id }: { id: string }) {
|
|
try {
|
|
const response = await apiConfig.delete(
|
|
`/mobile/investment/${id}/document`
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiInvestmentGetAll({
|
|
category,
|
|
authorId,
|
|
}: {
|
|
category: "my-holding" | "bursa";
|
|
authorId?: string;
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.get(
|
|
`/mobile/investment?category=${category}${
|
|
authorId ? `&authorId=${authorId}` : ""
|
|
}`
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiInvestmentCreateInvoice({
|
|
id,
|
|
data,
|
|
}: {
|
|
id: string;
|
|
data: any;
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.post(`/mobile/investment/${id}/invoice`, {
|
|
data: data,
|
|
});
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiInvestmentGetInvoice({
|
|
id,
|
|
authorId,
|
|
category,
|
|
}: {
|
|
id?: string;
|
|
authorId?: string;
|
|
category: "my-invest" | "transaction" | "invoice";
|
|
}) {
|
|
const categoryQuery = `?category=${category}`;
|
|
const authorIdQuery = authorId ? `&authorId=${authorId}` : "";
|
|
try {
|
|
const response = await apiConfig.get(
|
|
`/mobile/investment/${id}/invoice${categoryQuery}${authorIdQuery}`
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiInvestmentUpdateInvoice({
|
|
id,
|
|
data,
|
|
status,
|
|
}: {
|
|
id: string;
|
|
data: {
|
|
imageId?: string;
|
|
};
|
|
status: "berhasil" | "gagal" | "proses" | "menunggu";
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.put(
|
|
`/mobile/investment/${id}/invoice?status=${status}`,
|
|
{
|
|
data: data,
|
|
}
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiInvestmentCreateNews({
|
|
id,
|
|
data,
|
|
}: {
|
|
id: string;
|
|
data: any;
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.post(`/mobile/investment/${id}/news`, {
|
|
data: data,
|
|
});
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiInvestmentGetNews({
|
|
id,
|
|
category,
|
|
}: {
|
|
id: string;
|
|
category: "all-news" | "one-news";
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.get(
|
|
`/mobile/investment/${id}/news?category=${category}`
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiInvestmentDeleteNews({ id }: { id: string }) {
|
|
try {
|
|
const response = await apiConfig.delete(`/mobile/investment/${id}/news`);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiInvestmentGetInvestorById({
|
|
id,
|
|
}: {
|
|
id: string;
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.get(`/mobile/investment/${id}/investor`);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|