Skip to content

Commit

Permalink
feat(api-request): add putRefundFeeHeadersApi & rename actions & add …
Browse files Browse the repository at this point in the history
…translations (#895)
  • Loading branch information
yusualhashash authored Nov 27, 2024
2 parents 6d8a8bd + 4b33637 commit a6e74cc
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import type { GetApiContractServiceRefundTablesRefundFeeHeadersData } from "@ayasofyazilim/saas/ContractService";
import { notFound } from "next/navigation";
import { getResourceData } from "src/language-data/ContractService";
import { getRefundTableFeeHeadersApi } from "../../../../actions/ContractService/action";
import { getRefundFeeHeadersApi } from "../../../../actions/ContractService/action";
import Table from "./table";

export default async function Page(props: {
params: { lang: string };
searchParams: Promise<GetApiContractServiceRefundTablesRefundFeeHeadersData>;
}) {
const searchParams = await props.searchParams;
const response = await getRefundTableFeeHeadersApi(searchParams);
const response = await getRefundFeeHeadersApi(searchParams);
if (response.type !== "success") return notFound();

const { languageData } = await getResourceData(props.params.lang);
Expand Down
31 changes: 28 additions & 3 deletions apps/web/src/app/[lang]/app/actions/ContractService/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import type {
GetApiContractServiceMerchantsContractsContractHeadersByIdContractSettingsData,
GetApiContractServiceRebateTablesRebateTableHeadersTemplatesData,
GetApiContractServiceRefundTablesRefundFeeHeadersData,
GetApiContractServiceRefundTablesRefundFeeHeadersDetailByIdData,
GetApiContractServiceRefundTablesRefundTableHeadersByIdData,
GetApiContractServiceRefundTablesRefundTableHeadersData,
PostApiContractServiceMerchantsByIdContractsContractHeadersData,
PostApiContractServiceMerchantsContractsContractHeadersByIdContractSettingsData,
Expand Down Expand Up @@ -137,19 +139,42 @@ export async function getRefundTableHeadersApi(
return structuredError(error);
}
}
export async function getRefundTableFeeHeadersApi(
export async function getRefundTableHeadersById(
data: GetApiContractServiceRefundTablesRefundTableHeadersByIdData,
) {
try {
const requests = await getApiRequests();
return structuredResponse(
await requests.templates.getRefundTableHeadersById(data),
);
} catch (error) {
return structuredError(error);
}
}
export async function getRefundFeeHeadersApi(
data: GetApiContractServiceRefundTablesRefundFeeHeadersData,
) {
try {
const requests = await getApiRequests();
return structuredResponse(
await requests.templates.getRefundTableFeeHeaders(data),
await requests.templates.getRefundFeeHeaders(data),
);
} catch (error) {
return structuredError(error);
}
}
export async function getRefundFeeHeadersByIdApi(
data: GetApiContractServiceRefundTablesRefundFeeHeadersDetailByIdData,
) {
try {
const requests = await getApiRequests();
return structuredResponse(
await requests.templates.getRefundFeeHeadersById(data),
);
} catch (error) {
return structuredError(error);
}
}

export async function getRebateTableHeadersApi(
data: GetApiContractServiceRebateTablesRebateTableHeadersTemplatesData,
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use server";

import type {
PutApiContractServiceRebateTablesRebateTableHeadersByIdData,
PutApiContractServiceRefundTablesRefundFeeHeadersByIdData,
PutApiContractServiceRefundTablesRefundTableHeadersByIdData,
} from "@ayasofyazilim/saas/ContractService";
import { structuredError, structuredResponse } from "src/lib";
Expand Down Expand Up @@ -30,3 +30,14 @@ export async function putRefundTableHeadersApi(
return structuredError(error);
}
}
export async function putRefundFeeHeadersApi(
data: PutApiContractServiceRefundTablesRefundFeeHeadersByIdData,
) {
try {
const requests = await getApiRequests();
const response = await requests.templates.putRefundFeeHeadersApi(data);
return structuredResponse(response);
} catch (error) {
return structuredError(error);
}
}
23 changes: 22 additions & 1 deletion apps/web/src/app/[lang]/app/actions/api-requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import type {
GetApiContractServiceMerchantsByIdContractsContractHeadersData,
GetApiContractServiceMerchantsContractsContractHeadersByIdContractSettingsData,
GetApiContractServiceRebateTablesRebateTableHeadersTemplatesData,
GetApiContractServiceRefundTablesRefundFeeHeadersByIdData,
GetApiContractServiceRefundTablesRefundFeeHeadersData,
GetApiContractServiceRefundTablesRefundFeeHeadersDetailByIdData,
GetApiContractServiceRefundTablesRefundTableHeadersByIdData,
GetApiContractServiceRefundTablesRefundTableHeadersData,
PostApiContractServiceMerchantsByIdContractsContractHeadersData,
Expand All @@ -20,6 +22,7 @@ import type {
PutApiContractServiceMerchantsContractsContractHeadersByIdSetDefaultSettingData,
PutApiContractServiceMerchantsContractsContractSettingsByIdData,
PutApiContractServiceRebateTablesRebateTableHeadersByIdData,
PutApiContractServiceRefundTablesRefundFeeHeadersByIdData,
PutApiContractServiceRefundTablesRefundTableHeadersByIdData,
} from "@ayasofyazilim/saas/ContractService";
import type {
Expand Down Expand Up @@ -720,18 +723,36 @@ export async function getApiRequests() {
await contractsClient.refundTables.postApiContractServiceRefundTablesRefundTableHeadersByIdRefundTableDetails(
data,
),
getRefundTableFeeHeaders: async (
getRefundFeeHeaders: async (
data: GetApiContractServiceRefundTablesRefundFeeHeadersData,
) =>
await contractsClient.refundTables.getApiContractServiceRefundTablesRefundFeeHeaders(
data,
),
getRefundFeeHeadersById: async (
data: GetApiContractServiceRefundTablesRefundFeeHeadersByIdData,
) =>
await contractsClient.refundTables.getApiContractServiceRefundTablesRefundFeeHeadersById(
data,
),
getRefundFeeHeadersDetailById: async (
data: GetApiContractServiceRefundTablesRefundFeeHeadersDetailByIdData,
) =>
await contractsClient.refundTables.getApiContractServiceRefundTablesRefundFeeHeadersDetailById(
data,
),
postRefundFeeHeaders: async (
data: PostApiContractServiceRefundTablesRefundFeeHeadersData,
) =>
await contractsClient.refundTables.postApiContractServiceRefundTablesRefundFeeHeaders(
data,
),
putRefundFeeHeadersApi: async (
data: PutApiContractServiceRefundTablesRefundFeeHeadersByIdData,
) =>
await contractsClient.refundTables.putApiContractServiceRefundTablesRefundFeeHeadersById(
data,
),
getRebateTableHeaders: async (
data: GetApiContractServiceRebateTablesRebateTableHeadersTemplatesData,
) =>
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/language-data/Default/resources/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"Form.personalIdentificationCommonDatas": "Personal information",
"Form.personalPreferencesTypes": "Preferences",
"Form.isDefault": "Default",
"Form.isActive": "Active",

"Form.name.firstName": "First Name",
"Form.name.lastName": "Last Name",
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/language-data/Default/resources/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"Form.personalIdentificationCommonDatas": "Kişisel bilgiler",
"Form.personalPreferencesTypes": "Tercihler",
"Form.isDefault": "Varsayılan",
"Form.isActive": "Aktif",

"Form.name.firstName": "Ad",
"Form.name.lastName": "Soyad",
Expand Down

0 comments on commit a6e74cc

Please sign in to comment.