- KeyIn 결제 세부 수정
This commit is contained in:
@@ -45,6 +45,22 @@ export const KeyInPaymentRequestPage = () => {
|
|||||||
navigate(PATHS.additionalService.keyInPayment.list);
|
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 callKeyInPaymentRequest = () => {
|
||||||
const cardNo = `${cardNo1}${cardNo2}${cardNo3}${cardNo4}`;
|
const cardNo = `${cardNo1}${cardNo2}${cardNo3}${cardNo4}`;
|
||||||
const cardExpirationDate = `${cardExpirationMonth}${cardExpirationYear}`;
|
const cardExpirationDate = `${cardExpirationMonth}${cardExpirationYear}`;
|
||||||
@@ -63,11 +79,18 @@ export const KeyInPaymentRequestPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
keyInApply(keyInApplyParams).then((rs) => {
|
keyInApply(keyInApplyParams).then((rs) => {
|
||||||
console.log('결제 성공:', rs);
|
console.log('결제 응답:', rs);
|
||||||
showSuccessDialog();
|
if (rs.status) {
|
||||||
|
// 성공: 화면 유지 & 입력 내용 초기화
|
||||||
|
showSuccessDialog();
|
||||||
|
resetForm();
|
||||||
|
} else {
|
||||||
|
// 실패: 화면 유지 & 입력 내용 유지
|
||||||
|
showErrorDialog('결제에 실패했습니다. 입력 내용을 확인해주세요.');
|
||||||
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.error('결제 실패:', error);
|
console.error('결제 실패:', error);
|
||||||
showErrorDialog(error?.message || '결제에 실패했습니다');
|
showErrorDialog(error?.message || '결제 요청 중 오류가 발생했습니다');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -78,10 +101,7 @@ export const KeyInPaymentRequestPage = () => {
|
|||||||
afterLeave={unmount}
|
afterLeave={unmount}
|
||||||
open={isOpen}
|
open={isOpen}
|
||||||
onClose={close}
|
onClose={close}
|
||||||
onConfirmClick={() => {
|
onConfirmClick={close}
|
||||||
close();
|
|
||||||
navigate(PATHS.additionalService.keyInPayment.list);
|
|
||||||
}}
|
|
||||||
message="결제가 성공적으로 처리되었습니다"
|
message="결제가 성공적으로 처리되었습니다"
|
||||||
buttonLabel={['확인']}
|
buttonLabel={['확인']}
|
||||||
/>
|
/>
|
||||||
@@ -178,10 +198,11 @@ export const KeyInPaymentRequestPage = () => {
|
|||||||
<div className="billing-field">
|
<div className="billing-field">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
value={amount}
|
value={amount === 0 ? '' : amount.toString()}
|
||||||
|
placeholder="금액을 입력하세요"
|
||||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const onlyNumbers = e.target.value.replace(/[^0-9]/g, ''); // 숫자만 남김
|
const onlyNumbers = e.target.value.replace(/[^0-9]/g, ''); // 숫자만 남김
|
||||||
setAmount(onlyNumbers === '' ? 0 : parseInt(onlyNumbers));
|
setAmount(onlyNumbers === '' ? 0 : parseInt(onlyNumbers, 10));
|
||||||
}}
|
}}
|
||||||
inputMode="numeric" // 모바일 키보드 숫자 전용
|
inputMode="numeric" // 모바일 키보드 숫자 전용
|
||||||
pattern="[0-9]*" // 브라우저 기본 숫자만 유효하도록
|
pattern="[0-9]*" // 브라우저 기본 숫자만 유효하도록
|
||||||
|
|||||||
Reference in New Issue
Block a user