빌키 에스크로 추가 api 연ㄱㅕㄹ

This commit is contained in:
focp212@naver.com
2025-09-11 18:04:29 +09:00
parent 48a3bd1ed4
commit 84288188dc
24 changed files with 542 additions and 180 deletions

View File

@@ -1,7 +1,9 @@
import { ChangeEvent, useState } from 'react';
import { PATHS } from '@/shared/constants/paths';
import { IMAGE_ROOT } from '@/shared/constants/common';
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
import { HeaderType } from '@/entities/common/model/types';
import { useBillingChargeMutation } from '@/entities/transaction/api/use-billing-charge-mutation';
import {
useSetOnBack,
useSetHeaderTitle,
@@ -9,9 +11,17 @@ import {
useSetFooterMode
} from '@/widgets/sub-layout/use-sub-layout';
export const BillingPaymentRequestPage = () => {
export const BillingChargePage = () => {
const { navigate } = useNavigate();
const [billKey, setBillKey] = useState<string>('BIKYvattest01m');
const [productName, setProductName] = useState<string>('테스트상품123');
const [productAmount, setProductAmount] = useState<number | string>(1000000);
const [orderNumber, setOrderNumber] = useState<string>('P146733723');
const [buyerName, setBuyerName] = useState<string>('김테스트');
const [paymentRequestDate, setPaymentRequestDate] = useState<string>('2025-06-08');
const [installmentMonth, setInstallmentMonth] = useState<string>('00');
useSetHeaderTitle('빌링 결제 신청');
useSetHeaderType(HeaderType.RightClose);
useSetOnBack(() => {
@@ -19,6 +29,52 @@ export const BillingPaymentRequestPage = () => {
});
useSetFooterMode(false);
const { mutateAsync: billingCharge } = useBillingChargeMutation();
const onClickToBillingCharge = () => {
let params = {
billKey: billKey,
productName: productName,
productAmount: productAmount,
orderNumber: orderNumber,
buyerName: buyerName,
paymentRequestDate: paymentRequestDate,
installmentMonth: installmentMonth
};
billingCharge(params).then((rs) => {
console.log(rs);
alert('성공')
navigate(PATHS.transaction.billing.list);
});
};
const makeInstallmentMonthSelect = () => {
let rs = [];
rs.push(
<option
key={ `key-installment` }
value=''
></option>
);
rs.push(
<option
key={ `key-installment-0` }
value='00'
></option>
);
for(let i=2;i<=24;i++){
let val = (i < 10)? '0'+i: ''+i;
rs.push(
<option
key={ `key-installment-${i}`}
value={ val }
>{i}</option>
);
};
return rs;
};
return (
<>
<main>
@@ -26,15 +82,14 @@ export const BillingPaymentRequestPage = () => {
<div className="tab-pane sub active">
<div className="option-list">
<div className="billing-title"> </div>
<div className="billing-form">
<div className="billing-row">
<div className="billing-label"> <span>*</span></div>
<div className="billing-field">
<input
type="text"
value="BIKYvattest01m"
readOnly={ true }
value={ billKey }
/>
</div>
</div>
@@ -43,7 +98,8 @@ export const BillingPaymentRequestPage = () => {
<div className="billing-field">
<input
type="text"
value="테스트상품123"
value={ productName }
onChange={ (e: ChangeEvent<HTMLInputElement>) => setProductName(e.target.value) }
/>
</div>
</div>
@@ -52,7 +108,8 @@ export const BillingPaymentRequestPage = () => {
<div className="billing-field">
<input
type="text"
value="1,000,000"
value={ productAmount }
onChange={ (e: ChangeEvent<HTMLInputElement>) => setProductAmount(e.target.value) }
/>
</div>
</div>
@@ -61,7 +118,8 @@ export const BillingPaymentRequestPage = () => {
<div className="billing-field">
<input
type="text"
value="P146733723"
value={ orderNumber }
onChange={ (e: ChangeEvent<HTMLInputElement>) => setOrderNumber(e.target.value) }
/>
</div>
</div>
@@ -70,7 +128,8 @@ export const BillingPaymentRequestPage = () => {
<div className="billing-field">
<input
type="text"
value="김테스트"
value={ buyerName }
onChange={ (e: ChangeEvent<HTMLInputElement>) => setBuyerName(e.target.value) }
/>
</div>
</div>
@@ -81,8 +140,8 @@ export const BillingPaymentRequestPage = () => {
<div className="input-wrapper date wid-100">
<input
type="text"
value="2025/03/21"
placeholder=""
value={ paymentRequestDate }
/>
<button
className="date-btn"
@@ -101,19 +160,21 @@ export const BillingPaymentRequestPage = () => {
<div className="billing-row">
<div className="billing-label"> </div>
<div className="billing-field">
<select>
<option value=""></option>
<option value="0"></option>
<option value="2">2</option>
<option value="3">3</option>
<option value="6">6</option>
<select
value={ installmentMonth }
onChange={ (e: ChangeEvent<HTMLSelectElement>) => setBuyerName(e.target.value) }
>
{ makeInstallmentMonthSelect() }
</select>
</div>
</div>
</div>
</div>
<div className="apply-row">
<button className="btn-50 btn-blue flex-1"> </button>
<button
className="btn-50 btn-blue flex-1"
onClick={ () => onClickToBillingCharge() }
> </button>
</div>
</div>
</div>