From cb58b6b1d0a76c2a0d5aa5b52bd61db9722ec5e6 Mon Sep 17 00:00:00 2001 From: HyeonJongKim Date: Tue, 21 Oct 2025 18:16:27 +0900 Subject: [PATCH] =?UTF-8?q?-=20KeyIn=20=EA=B2=B0=EC=A0=9C=20=EC=84=B8?= =?UTF-8?q?=EB=B6=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../key-in-payment/requeset-page.tsx | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/src/pages/additional-service/key-in-payment/requeset-page.tsx b/src/pages/additional-service/key-in-payment/requeset-page.tsx index d2da84f..14956e0 100644 --- a/src/pages/additional-service/key-in-payment/requeset-page.tsx +++ b/src/pages/additional-service/key-in-payment/requeset-page.tsx @@ -45,6 +45,22 @@ export const KeyInPaymentRequestPage = () => { navigate(PATHS.additionalService.keyInPayment.list); }); + const resetForm = () => { + setGoodsName(''); + setAmount(0); + setBuyerName(''); + setEmail(''); + setPhoneNumber(''); + setCardNo1(''); + setCardNo2(''); + setCardNo3(''); + setCardNo4(''); + setCardExpirationMonth(''); + setCardExpirationYear(''); + setInstmntMonth('00'); + setMoid(''); + }; + const callKeyInPaymentRequest = () => { const cardNo = `${cardNo1}${cardNo2}${cardNo3}${cardNo4}`; const cardExpirationDate = `${cardExpirationMonth}${cardExpirationYear}`; @@ -63,11 +79,18 @@ export const KeyInPaymentRequestPage = () => { }; keyInApply(keyInApplyParams).then((rs) => { - console.log('결제 성공:', rs); - showSuccessDialog(); + console.log('결제 응답:', rs); + if (rs.status) { + // 성공: 화면 유지 & 입력 내용 초기화 + showSuccessDialog(); + resetForm(); + } else { + // 실패: 화면 유지 & 입력 내용 유지 + showErrorDialog('결제에 실패했습니다. 입력 내용을 확인해주세요.'); + } }).catch((error) => { console.error('결제 실패:', error); - showErrorDialog(error?.message || '결제에 실패했습니다'); + showErrorDialog(error?.message || '결제 요청 중 오류가 발생했습니다'); }); }; @@ -78,10 +101,7 @@ export const KeyInPaymentRequestPage = () => { afterLeave={unmount} open={isOpen} onClose={close} - onConfirmClick={() => { - close(); - navigate(PATHS.additionalService.keyInPayment.list); - }} + onConfirmClick={close} message="결제가 성공적으로 처리되었습니다" buttonLabel={['확인']} /> @@ -178,10 +198,11 @@ export const KeyInPaymentRequestPage = () => {
) => { const onlyNumbers = e.target.value.replace(/[^0-9]/g, ''); // 숫자만 남김 - setAmount(onlyNumbers === '' ? 0 : parseInt(onlyNumbers)); + setAmount(onlyNumbers === '' ? 0 : parseInt(onlyNumbers, 10)); }} inputMode="numeric" // 모바일 키보드 숫자 전용 pattern="[0-9]*" // 브라우저 기본 숫자만 유효하도록