부가서비스 - 링크결제 발송내역 상세: 페이지 로드 API, 재발송 API 연결
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_ADDITIONAL_SERVICE } from '@/shared/api/api-url-additional-service';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
DetailResponse,
|
||||
TitleInfo,
|
||||
ExtensionLinkPayHistoryDetailParams, ExtensionLinkPayHistoryDetailResponse,
|
||||
DetailInfo,
|
||||
PaymentInfo
|
||||
} from '../../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const extensionLinkPayHistoryDetail = async (params: ExtensionLinkPayHistoryDetailParams): Promise<DetailResponse> => {
|
||||
const response = await resultify(
|
||||
axios.post<ExtensionLinkPayHistoryDetailResponse>(API_URL_ADDITIONAL_SERVICE.extensionLinkPaymentHistoryDetail(), params),
|
||||
);
|
||||
|
||||
const detailResponse: DetailResponse = {
|
||||
titleInfo: {
|
||||
amount: response.amount,
|
||||
corpName: response.corpName,
|
||||
requestDate: response.paymentDate
|
||||
} as TitleInfo,
|
||||
paymentInfo: {
|
||||
buyerName: response.buyerName,
|
||||
sendMethod: response.sendMethod,
|
||||
sendDate: response.sendDate,
|
||||
paymentStatus: response.paymentMethod,
|
||||
failCount: response.failCount,
|
||||
paymentMethod: response.paymentMethod,
|
||||
paymentDate: response.paymentDate,
|
||||
paymentLimitDate: response.paymentLimitDate
|
||||
} as PaymentInfo,
|
||||
detailInfo: {
|
||||
email: response.email,
|
||||
phoneNumber: response.phoneNumber,
|
||||
moid: response.moid
|
||||
} as DetailInfo
|
||||
}
|
||||
|
||||
return detailResponse
|
||||
}
|
||||
|
||||
export const useExtensionLinkPayHistoryDetailMutation = (options?: UseMutationOptions<DetailResponse, CBDCAxiosError, ExtensionLinkPayHistoryDetailParams>) => {
|
||||
const mutation = useMutation<DetailResponse, CBDCAxiosError, ExtensionLinkPayHistoryDetailParams>({
|
||||
...options,
|
||||
mutationFn: (params: ExtensionLinkPayHistoryDetailParams) => extensionLinkPayHistoryDetail(params),
|
||||
});
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user