- 링크결제 API 수정
- 지급대행 수정
This commit is contained in:
@@ -30,7 +30,7 @@ export const LinkPaymentApplyConfirmPage = () => {
|
||||
goodsName: formData.goodsName,
|
||||
amount: formData.amount,
|
||||
moid: formData.moid,
|
||||
paymentExpiryDate: formData.paymentExpiryDate.replace(/\./g, ''),
|
||||
paymentLimitDate: formData.paymentLimitDate.replace(/\./g, ''),
|
||||
buyerName: formData.buyerName,
|
||||
email: formData.email,
|
||||
phoneNumber: formData.phoneNumber,
|
||||
|
||||
@@ -8,20 +8,22 @@ import {useNavigate} from '@/shared/lib/hooks/use-navigate';
|
||||
import {PATHS} from "@/shared/constants/paths";
|
||||
import { IdentityType, Language } from '@/entities/additional-service/model/types';
|
||||
import { LinkContentType, LinkPaymentFormData, LinkPaymentSendMethod } from '@/entities/additional-service/model/link-pay/types';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import moment from 'moment';
|
||||
|
||||
|
||||
|
||||
export const LinkPaymentApplyPage = () => {
|
||||
const { navigate } = useNavigate();
|
||||
|
||||
const userMid = useStore.getState().UserStore.mid;
|
||||
const [processStep, setProcessStep] = useState<ProcessStep>(ProcessStep.One);
|
||||
const [formData, setFormData] = useState<LinkPaymentFormData>({
|
||||
mid: 'nictest00m',
|
||||
mid: userMid,
|
||||
sendMethod: LinkPaymentSendMethod.SMS,
|
||||
goodsName: '',
|
||||
amount: 0,
|
||||
moid: '',
|
||||
paymentExpiryDate: '',
|
||||
paymentLimitDate: moment().format('YYYY.MM.DD'),
|
||||
buyerName: '',
|
||||
email: '',
|
||||
phoneNumber: '',
|
||||
@@ -36,10 +38,52 @@ export const LinkPaymentApplyPage = () => {
|
||||
useSetHeaderType(HeaderType.LeftArrow);
|
||||
useSetFooterMode(false);
|
||||
|
||||
// Step1 필수 필드 검증
|
||||
const isStep1Valid = () => {
|
||||
return (
|
||||
formData.mid !== '' &&
|
||||
formData.sendMethod !== '' &&
|
||||
formData.goodsName.trim() !== '' &&
|
||||
formData.amount > 0 &&
|
||||
formData.moid.trim() !== '' &&
|
||||
formData.paymentLimitDate !== ''
|
||||
);
|
||||
};
|
||||
|
||||
// 전화번호 형식 검증
|
||||
const isValidPhoneNumber = (phone: string) => {
|
||||
const phoneRegex = /^01[0|1|6|7|8|9][0-9]{7,8}$/;
|
||||
return phoneRegex.test(phone);
|
||||
};
|
||||
|
||||
// 이메일 형식 검증
|
||||
const isValidEmail = (email: string) => {
|
||||
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
return emailRegex.test(email);
|
||||
};
|
||||
|
||||
// Step2 필수 필드 검증
|
||||
const isStep2Valid = () => {
|
||||
const basicFieldsValid = (
|
||||
formData.buyerName.trim() !== '' &&
|
||||
formData.email.trim() !== '' &&
|
||||
isValidEmail(formData.email) &&
|
||||
formData.phoneNumber.trim() !== '' &&
|
||||
isValidPhoneNumber(formData.phoneNumber)
|
||||
);
|
||||
|
||||
// isIdentity가 true면 identityValue도 필수
|
||||
if (formData.isIdentity) {
|
||||
return basicFieldsValid && formData.identityValue.trim() !== '';
|
||||
}
|
||||
|
||||
return basicFieldsValid;
|
||||
};
|
||||
|
||||
const onClickToBack = () => {
|
||||
navigate(-1);
|
||||
};
|
||||
|
||||
setProcessStep(ProcessStep.One);
|
||||
};
|
||||
|
||||
const onClickToChangeTab = () => {
|
||||
if(processStep === ProcessStep.One) {
|
||||
setProcessStep(ProcessStep.Two);
|
||||
@@ -93,7 +137,8 @@ export const LinkPaymentApplyPage = () => {
|
||||
<div className="apply-row">
|
||||
<button
|
||||
className="btn-50 btn-blue flex-1"
|
||||
onClick={() => onClickToChangeTab() }
|
||||
onClick={() => onClickToChangeTab()}
|
||||
disabled={!isStep1Valid()}
|
||||
>다음</button>
|
||||
</div>
|
||||
}
|
||||
@@ -101,11 +146,12 @@ export const LinkPaymentApplyPage = () => {
|
||||
<div className="apply-row two-button">
|
||||
<button
|
||||
className="btn-50 btn-darkgray flex-1"
|
||||
onClick={() => onClickToBack() }
|
||||
>이전</button>
|
||||
onClick={() => onClickToBack()}
|
||||
>이전</button>
|
||||
<button
|
||||
className="btn-50 btn-blue flex-3"
|
||||
onClick={() => onClickToChangeTab() }
|
||||
onClick={() => onClickToChangeTab()}
|
||||
disabled={!isStep2Valid()}
|
||||
>결제 신청</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -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 >
|
||||
|
||||
@@ -21,7 +21,7 @@ import { ExtensionLinkPayWaitDeleteParams, ExtensionLinkPayWaitDetailParams } fr
|
||||
export const LinkPaymentWaitDetailPage = () => {
|
||||
const { navigate } = useNavigate();
|
||||
const location = useLocation();
|
||||
const { mid, tid } = location.state || {};
|
||||
const { mid, requestId } = location.state || {};
|
||||
const [titleInfo, setTitleInfo] = useState<TitleInfo>();
|
||||
const [paymentInfo, setPaymentInfo] = useState<PaymentInfo>();
|
||||
|
||||
@@ -34,10 +34,11 @@ export const LinkPaymentWaitDetailPage = () => {
|
||||
|
||||
const { mutateAsync: linkPayWaitDetail } = useExtensionLinkPayWaitDetailMutation();
|
||||
const { mutateAsync: linkPayWaitDelete } = useExtensionLinkPayWaitDeleteMutation();
|
||||
|
||||
const callDetail = () => {
|
||||
let detailParam: ExtensionLinkPayWaitDetailParams = {
|
||||
mid: mid,
|
||||
tid: tid
|
||||
requestId: requestId
|
||||
}
|
||||
|
||||
linkPayWaitDetail(detailParam).then((rs: DetailResponse) => {
|
||||
@@ -51,7 +52,7 @@ export const LinkPaymentWaitDetailPage = () => {
|
||||
const deletePayment = () => {
|
||||
let deleteParam: ExtensionLinkPayWaitDeleteParams = {
|
||||
mid: mid,
|
||||
tid: tid
|
||||
requestId: requestId
|
||||
}
|
||||
linkPayWaitDelete(deleteParam)
|
||||
.then((response) => {
|
||||
|
||||
Reference in New Issue
Block a user