api 추가

This commit is contained in:
focp212@naver.com
2025-11-10 18:03:38 +09:00
parent f547ec2c39
commit 5d398c9d77
5 changed files with 70 additions and 2 deletions

View File

@@ -0,0 +1,39 @@
import axios from 'axios';
import { API_URL_TRANSACTION } from '@/shared/api/api-url-transaction';
import { resultify } from '@/shared/lib/resultify';
import { NiceAxiosError } from '@/shared/@types/error';
import {
CashReceiptExcelDownloadParams,
CashReceiptExcelDownloadResponse
} from '../model/types';
import {
useMutation,
UseMutationOptions
} from '@tanstack/react-query';
import { getHeaderUserAgent } from '@/shared/constants/url';
export const cashReceiptExcelDownload = (params: CashReceiptExcelDownloadParams) => {
let headerOptions = {
menuId: 32,
apiType: 'DOWNLOAD'
};
let options = {
headers: {
'X-User-Agent': getHeaderUserAgent(headerOptions)
}
};
return resultify(
axios.post<CashReceiptExcelDownloadResponse>(API_URL_TRANSACTION.cashReceiptReceiptDownload(), params, options),
);
};
export const useCashReceiptExcelDownloadMutation = (options?: UseMutationOptions<CashReceiptExcelDownloadResponse, NiceAxiosError, CashReceiptExcelDownloadParams>) => {
const mutation = useMutation<CashReceiptExcelDownloadResponse, NiceAxiosError, CashReceiptExcelDownloadParams>({
...options,
mutationFn: (params: CashReceiptExcelDownloadParams) => cashReceiptExcelDownload(params),
});
return {
...mutation,
};
};

View File

@@ -292,6 +292,22 @@ export interface CashReceiptReceiptDownloadResponse {
customerInfo: CustomerInfo;
productInfo: ProductInfo;
};
export enum CashReceiptDateType {
ISSUE_DATE = 'ISSUE_DATE',
CANCEL_DATE = 'CANCEL_DATE'
};
export interface CashReceiptExcelDownloadParams {
email: string;
mid: string;
startDate: string;
endDate: string;
dateType: CashReceiptDateType;
purposeType: CashReceiptPurposeType;
transactionType: CashReceiptTransactionType;
processResult: CashReceiptProcessResult;
};
export interface CashReceiptExcelDownloadResponse {};
export interface EscrowListParams {
mid?: string;
searchType?: string;

View File

@@ -428,7 +428,7 @@ export const AmountInfoSection = ({
}
<div className="txn-doc">
{ (transactionCategory === TransactionCategory.CashReceipt) &&
// !!canDownloadReceipt &&
!!canDownloadReceipt &&
<button
className="doc-btn"
type="button"
@@ -446,7 +446,7 @@ export const AmountInfoSection = ({
sendRequest={ onRequestDownload }
></DownloadBottomSheet>
}
{
{ !!cashReceiptSampleOn &&
<CashReceiptSample
cashReceiptSampleOn={ cashReceiptSampleOn }
setCashReceiptSampleOn={ setCashReceiptSampleOn }