- 링크결제 API 수정
- 지급대행 수정
This commit is contained in:
@@ -18,12 +18,13 @@ import { PaymentInfoWrap } from '@/entities/additional-service/ui/info-wrap/paym
|
||||
import { DetailInfoWrap } from '@/entities/additional-service/ui/info-wrap/detail-info-wrap';
|
||||
import { useExtensionLinkPayHistoryResendMutation } from '@/entities/additional-service/api/link-payment/use-extension-link-pay-history-resend-mutation';
|
||||
import { ExtensionLinkPayHistoryDetailParams, ExtensionLinkPayHistoryResendParams } from '@/entities/additional-service/model/link-pay/types';
|
||||
import moment from 'moment';
|
||||
|
||||
export const LinkPaymentDetailPage = () => {
|
||||
const { navigate } = useNavigate();
|
||||
const location = useLocation();
|
||||
|
||||
const { mid, tid } = location.state || {};
|
||||
const { mid, tid, requestId, subReqId } = location.state || {};
|
||||
|
||||
const [titleInfo, setTitleInfo] = useState<TitleInfo>();
|
||||
const [detailInfo, setDetailInfo] = useState<DetailInfo>();
|
||||
@@ -34,16 +35,19 @@ export const LinkPaymentDetailPage = () => {
|
||||
useSetHeaderTitle('링크결제 상세');
|
||||
useSetHeaderType(HeaderType.RightClose);
|
||||
useSetOnBack(() => {
|
||||
navigate(PATHS.additionalService.linkPayment.shippingHistory);
|
||||
navigate(-1); // 브라우저 히스토리를 이용한 뒤로가기
|
||||
});
|
||||
useSetFooterMode(false);
|
||||
|
||||
const { mutateAsync: linkPayHistoryDetail } = useExtensionLinkPayHistoryDetailMutation();
|
||||
const { mutateAsync: linkPayHistoryResend } = useExtensionLinkPayHistoryResendMutation();
|
||||
|
||||
// 상세내역 조회
|
||||
const callDetail = () => {
|
||||
let detailParam: ExtensionLinkPayHistoryDetailParams = {
|
||||
mid: mid,
|
||||
tid: tid
|
||||
requestId: requestId,
|
||||
subReqId: subReqId
|
||||
}
|
||||
linkPayHistoryDetail(detailParam).then((rs: DetailResponse) => {
|
||||
console.log("Detail Info: ", rs)
|
||||
@@ -53,15 +57,18 @@ export const LinkPaymentDetailPage = () => {
|
||||
})
|
||||
}
|
||||
|
||||
//제발송 API
|
||||
const resendPayment = () => {
|
||||
let resendParam: ExtensionLinkPayHistoryResendParams = {
|
||||
mid: mid,
|
||||
tid: tid
|
||||
requestId: requestId,
|
||||
sendMethod: paymentInfo?.sendMethod
|
||||
}
|
||||
linkPayHistoryResend(resendParam)
|
||||
.then((response) => {
|
||||
console.log("Resend 성공 응답: ", response);
|
||||
onClickToNavigate(PATHS.additionalService.linkPayment.shippingHistory)
|
||||
// 현재 화면 유지하고 데이터 새로고침
|
||||
callDetail();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Resend 실패: ", error);
|
||||
@@ -103,6 +110,24 @@ export const LinkPaymentDetailPage = () => {
|
||||
state: { mid, tid }
|
||||
});
|
||||
};
|
||||
|
||||
// 재발송 버튼 활성화 조건 체크
|
||||
const isResendEnabled = () => {
|
||||
// paymentStatus가 "ACTIVE"이고
|
||||
if (paymentInfo?.paymentStatus !== 'ACTIVE') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// paymentLimitDate가 오늘 날짜를 지나지 않았을 때
|
||||
if (paymentInfo?.paymentLimitDate) {
|
||||
const limitDate = moment(paymentInfo.paymentLimitDate, 'YYYYMMDD');
|
||||
const today = moment().startOf('day');
|
||||
return limitDate.isSameOrAfter(today);
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
callDetail();
|
||||
}, []);
|
||||
@@ -129,18 +154,19 @@ export const LinkPaymentDetailPage = () => {
|
||||
detailInfo={detailInfo}
|
||||
></DetailInfoWrap>
|
||||
</div>
|
||||
<div className="apply-row">
|
||||
{/* <div className="apply-row">
|
||||
<button
|
||||
className="btn-50 btn-blue flex-1"
|
||||
onClick={() => onClickToSeparateApproval()}
|
||||
>분리승인 상세</button>
|
||||
</div>
|
||||
{/* <div className="apply-row">
|
||||
</div> */}
|
||||
<div className="apply-row">
|
||||
<button
|
||||
className="btn-50 btn-blue flex-1"
|
||||
onClick={() => onClickToResend()}
|
||||
disabled={!isResendEnabled()}
|
||||
>재발송</button>
|
||||
</div> */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main >
|
||||
|
||||
Reference in New Issue
Block a user