결제 관리 API 연결

This commit is contained in:
focp212@naver.com
2025-09-19 13:05:46 +09:00
parent b900c16b71
commit b01190b395
6 changed files with 199 additions and 92 deletions

View File

@@ -64,13 +64,35 @@ export interface PaymentNonCardResponse {
otherPaymentData: OtherPaymentData; otherPaymentData: OtherPaymentData;
}; };
export interface AccountTransferData { export interface AccountTransferData {
feeRanges: Array<Record<string, any>>; feeRanges: Array<FeeRanges>;
bankFees: Array<Record<string, any>>; bankFees: Array<BankFees>;
};
export interface FeeRanges {
id: number;
feeRange: string;
feeAmount: string;
};
export interface BankFees {
id: number;
bankName: string;
feeAmount: string;
}; };
export interface MobilePaymentData { export interface MobilePaymentData {
paymentFees: Array<Record<string, any>>; paymentFees: Array<PaymentFees>;
categoryFees: Array<Record<string, any>>; categoryFees: Array<CategoryFees>;
}; };
export interface PaymentFees {
id: number;
category: string;
feeRate: number;
feeAmount: string;
};
export interface CategoryFees {
id: number;
category: string;
feeRate: number;
};
export interface OtherPaymentData { export interface OtherPaymentData {
feeRate: number; feeRate: number;
}; };
@@ -78,7 +100,12 @@ export interface PaymentInstallmentParams extends PaymentCommonParams {
paymentMethod: string; paymentMethod: string;
}; };
export interface PaymentInstallmentResponse { export interface PaymentInstallmentResponse {
installmentData: Array<Record<string, any>>; installmentData: Array<InstallmentData>;
};
export interface InstallmentData {
id: number;
category: string;
detailLink: string;
}; };
export interface InstallmentDetails { export interface InstallmentDetails {
id: number; id: number;
@@ -104,11 +131,27 @@ export interface PaymentCardResponse {
moneyPointTab: MoneyPointTab; moneyPointTab: MoneyPointTab;
}; };
export interface GeneralTab { export interface GeneralTab {
items: Array<Record<string, any>>; items: Array<GeneralTabItems>;
};
export interface GeneralTabItems {
id: number;
cardCompany: string;
feeRate: number;
}; };
export interface InstallmentTab { export interface InstallmentTab {
items: Array<Record<string, any>>; items: Array<InstallmentTabItems>;
};
export interface InstallmentTabItems {
id: number;
installmentMonth: string;
cardCompany: string;
feeRate: number;
}; };
export interface MoneyPointTab { export interface MoneyPointTab {
items: Array<Record<string, any>>; items: Array<MoneyPointTabItems>;
};
export interface MoneyPointTabItems {
id: number;
category: string;
feeRate: number;
}; };

View File

@@ -1,11 +1,33 @@
import { motion } from 'framer-motion';
import { IMAGE_ROOT } from '@/shared/constants/common'; import { IMAGE_ROOT } from '@/shared/constants/common';
import { BottomSheetMotionDuration, BottomSheetMotionVaiants } from '@/entities/common/model/constant';
export const CardCommissionCycleBottomSheet = () => { export interface CardCommissionBottomSheetProps {
cardCommissionBottomSheetOn: boolean;
setCardCommissionBottomSheetOn: (cardCommissionBottomSheetOn: boolean) => void;
};
export const CardCommissionBottomSheet = ({
cardCommissionBottomSheetOn,
setCardCommissionBottomSheetOn
}: CardCommissionBottomSheetProps) => {
const onClickToClose = () => {
setCardCommissionBottomSheetOn(false);
};
return ( return (
<> <>
{ cardCommissionBottomSheetOn &&
<div className="bg-dim"></div> <div className="bg-dim"></div>
<div className="bottomsheet"> }
<motion.div
className="bottomsheet"
initial="hidden"
animate={ (cardCommissionBottomSheetOn)? 'visible': 'hidden' }
variants={ BottomSheetMotionVaiants }
transition={ BottomSheetMotionDuration }
>
<div className="bottomsheet-header"> <div className="bottomsheet-header">
<div className="bottomsheet-title"> <div className="bottomsheet-title">
<h2> </h2> <h2> </h2>
@@ -14,8 +36,9 @@ export const CardCommissionCycleBottomSheet = () => {
type="button" type="button"
> >
<img <img
src={ IMAGE_ROOT + '/images/ico_close.svg' } src={ IMAGE_ROOT + '/ico_close.svg' }
alt="닫기" alt="닫기"
onClick={ () => onClickToClose() }
/> />
</button> </button>
</div> </div>
@@ -102,7 +125,7 @@ export const CardCommissionCycleBottomSheet = () => {
>신청</button> >신청</button>
</div> </div>
*/} */}
</div> </motion.div>
</> </>
); );
}; };

View File

@@ -1,11 +1,33 @@
import { motion } from 'framer-motion';
import { IMAGE_ROOT } from '@/shared/constants/common'; import { IMAGE_ROOT } from '@/shared/constants/common';
import { BottomSheetMotionDuration, BottomSheetMotionVaiants } from '@/entities/common/model/constant';
export const CreditCardListBottomSheet = () => { export interface CreditCardListBottomSheetProps {
creditCardListBottomSheetOn: boolean;
setCreditCardListBottomSheetOn: (creditCardListBottomSheetOn: boolean) => void;
};
export const CreditCardListBottomSheet = ({
creditCardListBottomSheetOn,
setCreditCardListBottomSheetOn
}: CreditCardListBottomSheetProps) => {
const onClickToClose = () => {
setCreditCardListBottomSheetOn(false);
};
return ( return (
<> <>
{ creditCardListBottomSheetOn &&
<div className="bg-dim"></div> <div className="bg-dim"></div>
<div className="bottomsheet"> }
<motion.div
className="bottomsheet"
initial="hidden"
animate={ (creditCardListBottomSheetOn)? 'visible': 'hidden' }
variants={ BottomSheetMotionVaiants }
transition={ BottomSheetMotionDuration }
>
<div className="bottomsheet-header"> <div className="bottomsheet-header">
<div className="bottomsheet-title"> <div className="bottomsheet-title">
<h2></h2> <h2></h2>
@@ -16,6 +38,7 @@ export const CreditCardListBottomSheet = () => {
<img <img
src={ IMAGE_ROOT + '/ico_close.svg' } src={ IMAGE_ROOT + '/ico_close.svg' }
alt="닫기" alt="닫기"
onClick={ () => onClickToClose() }
/> />
</button> </button>
</div> </div>
@@ -59,7 +82,7 @@ export const CreditCardListBottomSheet = () => {
type="button" type="button"
></button> ></button>
</div> </div>
</div> </motion.div>
</> </>
); );
}; };

View File

@@ -1,36 +1,59 @@
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { IMAGE_ROOT } from '@/shared/constants/common'; import { IMAGE_ROOT } from '@/shared/constants/common';
import { InfoItem } from './info-item'; import { InfoItem } from './info-item';
import { CardCommissionBottomSheet } from './card-commission-bottom-sheet';
import { CreditCardListBottomSheet } from './credit-card-list-bottom-sheet';
import { NoInterestInfoBottomSheet } from './no-interest-info-bottom-sheet'; import { NoInterestInfoBottomSheet } from './no-interest-info-bottom-sheet';
import { usePaymentInstallmentDetailMutation } from '../api/use-payment-installment-detail-mutation'; import { usePaymentInstallmentDetailMutation } from '../api/use-payment-installment-detail-mutation';
import { import {
AccountTransferData,
GeneralTab,
InstallmentData,
InstallmentDetails, InstallmentDetails,
InstallmentTab,
MobilePaymentData,
MoneyPointTab,
OtherPaymentData,
PaymentCardParams,
PaymentCardResponse, PaymentCardResponse,
PaymentInfoItemType, PaymentInfoItemType,
PaymentInstallmentDetailParams,
PaymentInstallmentDetailResponse, PaymentInstallmentDetailResponse,
PaymentInstallmentParams,
PaymentInstallmentResponse, PaymentInstallmentResponse,
PaymentNonCardParams,
PaymentNonCardResponse PaymentNonCardResponse
} from '../model/types'; } from '../model/types';
import { usePaymentCardMutation } from '../api/use-payment-card-mutation';
import { usePaymentNonCardMutation } from '../api/use-payment-non-card-mutation';
import { usePaymentInstallmentMutation } from '../api/use-payment-installment-mutation';
export interface InfoWrapProp { export const InfoWrap = () => {
mid: string;
paymentCard?: PaymentCardResponse, const [mid, setMid] = useState<string>('nictest00g');
paymentNonCard?: PaymentNonCardResponse,
paymentInstallment?: PaymentInstallmentResponse
};
export const InfoWrap = ({
mid,
paymentCard,
paymentNonCard,
paymentInstallment
}: InfoWrapProp) => {
const [noInterestInfoBottomSheetOn, setNoInterestInfoBottomSheetOn] = useState<boolean>(false); const [noInterestInfoBottomSheetOn, setNoInterestInfoBottomSheetOn] = useState<boolean>(false);
const [cardCommissionBottomSheetOn, setCardCommissionBottomSheetOn] = useState<boolean>(false);
const [creditCardListBottomSheetOn, setCreditCardListBottomSheetOn] = useState<boolean>(false);
const [cardCompany, setCardCompany] = useState<string>('비씨'); const [cardCompany, setCardCompany] = useState<string>('비씨');
const [cardCompanyOptions, setCardCompanyOptions] = useState<Array<string>>(); const [cardCompanyOptions, setCardCompanyOptions] = useState<Array<string>>();
const [installmentDetails, setInstallmentDetails] = useState<Array<InstallmentDetails>>([]); const [installmentDetails, setInstallmentDetails] = useState<Array<InstallmentDetails>>([]);
const [settlementPeriod, setSettlementPeriod] = useState<string>();
const [generalTab, setGeneralTab] = useState<GeneralTab>();
const [installmentTab, setInstallmentTab] = useState<InstallmentTab>();
const [moneyPointTab, setMoneyPointTab] = useState<MoneyPointTab>();
const [accountTransferData, setAccountTransferData] = useState<AccountTransferData>();
const [mobilePaymentData, setMobilePaymentData] = useState<MobilePaymentData>();
const [otherPaymentData, setOtherPaymentData] = useState<OtherPaymentData>();
const [installmentData, setInstallmentData] = useState<Array<InstallmentData>>();
const { mutateAsync: paymentCard } = usePaymentCardMutation();
const { mutateAsync: paymentNonCard } = usePaymentNonCardMutation();
const { mutateAsync: paymentInstallment } = usePaymentInstallmentMutation();
const { mutateAsync: paymentInstallmentDetail } = usePaymentInstallmentDetailMutation(); const { mutateAsync: paymentInstallmentDetail } = usePaymentInstallmentDetailMutation();
const list1 = [ const list1 = [
@@ -98,20 +121,64 @@ export const InfoWrap = ({
return rs; return rs;
}; };
const callPaymentCard = () => {
let params: PaymentCardParams = {
mid: mid,
paymentMethod: 'CREDIT_CARD'
};
paymentCard(params).then((rs: PaymentCardResponse) => {
console.log(rs);
setSettlementPeriod(rs.settlementPeriod);
setGeneralTab(rs.generalTab);
setInstallmentTab(rs.installmentTab);
setMoneyPointTab(rs.moneyPointTab);
});
};
const callPaymentNonCard = () => {
let params: PaymentNonCardParams = {
mid: mid,
paymentMethod: 'ACCOUNT_TRANSFER'
};
paymentNonCard(params).then((rs: PaymentNonCardResponse) => {
console.log(rs);
setSettlementPeriod(rs.settlementPeriod);
setAccountTransferData(rs.accountTransferData);
setMobilePaymentData(rs.mobilePaymentData);
setOtherPaymentData(rs.otherPaymentData);
});
};
const callPaymentIntallment = () => {
let params: PaymentInstallmentParams = {
mid: mid,
paymentMethod: 'CREDIT_CARD'
};
paymentInstallment(params).then((rs: PaymentInstallmentResponse) => {
console.log(rs);
setInstallmentData(rs.installmentData);
});
};
const callPaymentIntallmentDetail = () => { const callPaymentIntallmentDetail = () => {
let params = { let params: PaymentInstallmentDetailParams = {
mid: mid, mid: mid,
cardCompany: cardCompany cardCompany: cardCompany
}; };
paymentInstallmentDetail(params).then((rs) => { paymentInstallmentDetail(params).then((rs: PaymentInstallmentDetailResponse) => {
console.log(rs); console.log(rs);
setCardCompany(rs.cardCompany); setCardCompany(rs.cardCompany);
setCardCompanyOptions(rs.cardCompanyOptions); setCardCompanyOptions(rs.cardCompanyOptions);
setInstallmentDetails(rs.installmentDetails); setInstallmentDetails(rs.installmentDetails);
}); });
}; };
useEffect(() => {
callPaymentCard();
callPaymentNonCard();
callPaymentIntallment();
}, []);
useEffect(() => { useEffect(() => {
callPaymentIntallmentDetail(); callPaymentIntallmentDetail();
}, [cardCompany]); }, [cardCompany]);
@@ -129,6 +196,14 @@ export const InfoWrap = ({
{ getList(PaymentInfoItemType.NoInterest) } { getList(PaymentInfoItemType.NoInterest) }
</ul> </ul>
</div> </div>
<CardCommissionBottomSheet
cardCommissionBottomSheetOn={ cardCommissionBottomSheetOn }
setCardCommissionBottomSheetOn={ setCardCommissionBottomSheetOn }
></CardCommissionBottomSheet>
<CreditCardListBottomSheet
creditCardListBottomSheetOn={ creditCardListBottomSheetOn }
setCreditCardListBottomSheetOn={ setCreditCardListBottomSheetOn }
></CreditCardListBottomSheet>
<NoInterestInfoBottomSheet <NoInterestInfoBottomSheet
noInterestInfoBottomSheetOn={ noInterestInfoBottomSheetOn } noInterestInfoBottomSheetOn={ noInterestInfoBottomSheetOn }
setNoInterestInfoBottomSheetOn={ setNoInterestInfoBottomSheetOn } setNoInterestInfoBottomSheetOn={ setNoInterestInfoBottomSheetOn }

View File

@@ -22,8 +22,8 @@ export const NoInterestInfoBottomSheet = ({
installmentDetails, installmentDetails,
setCardCompany setCardCompany
}: NoInterestInfoBottomSheetProps) => { }: NoInterestInfoBottomSheetProps) => {
const onClickToClose = () => { const onClickToClose = () => {
// close
setNoInterestInfoBottomSheetOn(false); setNoInterestInfoBottomSheetOn(false);
}; };

View File

@@ -1,11 +1,9 @@
import { useEffect, useState } from 'react'; import { useState } from 'react';
import { PATHS } from '@/shared/constants/paths'; import { PATHS } from '@/shared/constants/paths';
import { useNavigate } from '@/shared/lib/hooks/use-navigate'; import { useNavigate } from '@/shared/lib/hooks/use-navigate';
import { PaymentTab } from '@/entities/payment/ui/payment-tab'; import { PaymentTab } from '@/entities/payment/ui/payment-tab';
import { InfoWrap } from '@/entities/payment/ui/info-wrap'; import { InfoWrap } from '@/entities/payment/ui/info-wrap';
import { PaymentCardResponse, PaymentInstallmentResponse, PaymentNonCardResponse, PaymentTabKeys } from '@/entities/payment/model/types'; import { PaymentTabKeys } from '@/entities/payment/model/types';
import { usePaymentCardMutation } from '@/entities/payment/api/use-payment-card-mutation';
import { usePaymentNonCardMutation } from '@/entities/payment/api/use-payment-non-card-mutation';
import { HeaderType } from '@/entities/common/model/types'; import { HeaderType } from '@/entities/common/model/types';
import { import {
useSetHeaderTitle, useSetHeaderTitle,
@@ -13,21 +11,11 @@ import {
useSetFooterMode, useSetFooterMode,
useSetOnBack useSetOnBack
} from '@/widgets/sub-layout/use-sub-layout'; } from '@/widgets/sub-layout/use-sub-layout';
import { usePaymentInstallmentMutation } from '@/entities/payment/api/use-payment-installment-mutation';
export const InfoPage = () => { export const InfoPage = () => {
const { navigate } = useNavigate(); const { navigate } = useNavigate();
const { mutateAsync: paymentCard } = usePaymentCardMutation();
const { mutateAsync: paymentNonCard } = usePaymentNonCardMutation();
const { mutateAsync: paymentInstallment } = usePaymentInstallmentMutation();
const [activeTab, setActiveTab] = useState<PaymentTabKeys>(PaymentTabKeys.Info); const [activeTab, setActiveTab] = useState<PaymentTabKeys>(PaymentTabKeys.Info);
const [mid, setMid] = useState<string>('nictest00g');
const [paymentCardResult, setPaymentCardResult] = useState<PaymentCardResponse>();
const [paymentNonCardResult, setPaymentNonCardResult] = useState<PaymentNonCardResponse>();
const [paymentInstallmentResult, setPaymentInstallResult] = useState<PaymentInstallmentResponse>();
useSetHeaderTitle('결제 관리'); useSetHeaderTitle('결제 관리');
useSetHeaderType(HeaderType.LeftArrow); useSetHeaderType(HeaderType.LeftArrow);
@@ -36,58 +24,13 @@ export const InfoPage = () => {
navigate(PATHS.home); navigate(PATHS.home);
}); });
const callPaymentCard = () => {
let params = {
mid: mid,
paymentMethod: 'CREDIT_CARD'
};
paymentCard(params).then((rs) => {
console.log(rs);
setPaymentCardResult(rs);
});
};
const callPaymentNonCard = () => {
let params = {
mid: mid,
paymentMethod: 'ACCOUNT_TRANSFER'
};
paymentNonCard(params).then((rs) => {
console.log(rs);
setPaymentNonCardResult(rs);
});
};
const callPaymentIntallment = () => {
let params = {
mid: mid,
paymentMethod: 'CREDIT_CARD'
};
paymentInstallment(params).then((rs) => {
console.log(rs);
setPaymentInstallResult(rs);
});
};
useEffect(() => {
callPaymentCard();
callPaymentNonCard();
callPaymentIntallment();
}, []);
return ( return (
<> <>
<main> <main>
<div className="tab-content pb-70"> <div className="tab-content pb-70">
<div className="tab-pane pt-46 active"> <div className="tab-pane pt-46 active">
<PaymentTab activeTab={ activeTab }></PaymentTab> <PaymentTab activeTab={ activeTab }></PaymentTab>
<InfoWrap <InfoWrap></InfoWrap>
mid={ mid }
paymentCard={ paymentCardResult }
paymentNonCard={ paymentNonCardResult }
paymentInstallment={ paymentInstallmentResult }
></InfoWrap>
</div> </div>
</div> </div>
</main> </main>