diff --git a/src/entities/payment/model/types.ts b/src/entities/payment/model/types.ts index d3ceeef..55b4060 100644 --- a/src/entities/payment/model/types.ts +++ b/src/entities/payment/model/types.ts @@ -64,13 +64,35 @@ export interface PaymentNonCardResponse { otherPaymentData: OtherPaymentData; }; export interface AccountTransferData { - feeRanges: Array>; - bankFees: Array>; + feeRanges: Array; + bankFees: Array; +}; +export interface FeeRanges { + id: number; + feeRange: string; + feeAmount: string; +}; +export interface BankFees { + id: number; + bankName: string; + feeAmount: string; }; export interface MobilePaymentData { - paymentFees: Array>; - categoryFees: Array>; + paymentFees: Array; + categoryFees: Array; }; +export interface PaymentFees { + id: number; + category: string; + feeRate: number; + feeAmount: string; +}; +export interface CategoryFees { + id: number; + category: string; + feeRate: number; +}; + export interface OtherPaymentData { feeRate: number; }; @@ -78,7 +100,12 @@ export interface PaymentInstallmentParams extends PaymentCommonParams { paymentMethod: string; }; export interface PaymentInstallmentResponse { - installmentData: Array>; + installmentData: Array; +}; +export interface InstallmentData { + id: number; + category: string; + detailLink: string; }; export interface InstallmentDetails { id: number; @@ -104,11 +131,27 @@ export interface PaymentCardResponse { moneyPointTab: MoneyPointTab; }; export interface GeneralTab { - items: Array>; + items: Array; +}; +export interface GeneralTabItems { + id: number; + cardCompany: string; + feeRate: number; }; export interface InstallmentTab { - items: Array>; + items: Array; +}; +export interface InstallmentTabItems { + id: number; + installmentMonth: string; + cardCompany: string; + feeRate: number; }; export interface MoneyPointTab { - items: Array>; + items: Array; +}; +export interface MoneyPointTabItems { + id: number; + category: string; + feeRate: number; }; diff --git a/src/entities/payment/ui/card-commission-bottom-sheet.tsx b/src/entities/payment/ui/card-commission-bottom-sheet.tsx index 605db16..73d7f31 100644 --- a/src/entities/payment/ui/card-commission-bottom-sheet.tsx +++ b/src/entities/payment/ui/card-commission-bottom-sheet.tsx @@ -1,11 +1,33 @@ +import { motion } from 'framer-motion'; 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 ( <> -
-
+ { cardCommissionBottomSheetOn && +
+ } +

수수료 및 정산주기

@@ -14,8 +36,9 @@ export const CardCommissionCycleBottomSheet = () => { type="button" > 닫기 onClickToClose() } />
@@ -102,7 +125,7 @@ export const CardCommissionCycleBottomSheet = () => { >신청
*/} -
+ ); }; \ No newline at end of file diff --git a/src/entities/payment/ui/credit-card-list-bottom-sheet.tsx b/src/entities/payment/ui/credit-card-list-bottom-sheet.tsx index 4a230fb..e48a87d 100644 --- a/src/entities/payment/ui/credit-card-list-bottom-sheet.tsx +++ b/src/entities/payment/ui/credit-card-list-bottom-sheet.tsx @@ -1,11 +1,33 @@ +import { motion } from 'framer-motion'; 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 ( <> + { creditCardListBottomSheetOn &&
-
+ } +

카드사

@@ -16,6 +38,7 @@ export const CreditCardListBottomSheet = () => { 닫기 onClickToClose() } />
@@ -59,7 +82,7 @@ export const CreditCardListBottomSheet = () => { type="button" >확인
-
+ ); }; \ No newline at end of file diff --git a/src/entities/payment/ui/info-wrap.tsx b/src/entities/payment/ui/info-wrap.tsx index f92725e..5d344ca 100644 --- a/src/entities/payment/ui/info-wrap.tsx +++ b/src/entities/payment/ui/info-wrap.tsx @@ -1,36 +1,59 @@ import { useEffect, useState } from 'react'; import { IMAGE_ROOT } from '@/shared/constants/common'; 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 { usePaymentInstallmentDetailMutation } from '../api/use-payment-installment-detail-mutation'; import { + AccountTransferData, + GeneralTab, + InstallmentData, InstallmentDetails, + InstallmentTab, + MobilePaymentData, + MoneyPointTab, + OtherPaymentData, + PaymentCardParams, PaymentCardResponse, PaymentInfoItemType, + PaymentInstallmentDetailParams, PaymentInstallmentDetailResponse, + PaymentInstallmentParams, PaymentInstallmentResponse, + PaymentNonCardParams, PaymentNonCardResponse } 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 { - mid: string; - paymentCard?: PaymentCardResponse, - paymentNonCard?: PaymentNonCardResponse, - paymentInstallment?: PaymentInstallmentResponse -}; -export const InfoWrap = ({ - mid, - paymentCard, - paymentNonCard, - paymentInstallment -}: InfoWrapProp) => { +export const InfoWrap = () => { + const [mid, setMid] = useState('nictest00g'); + const [noInterestInfoBottomSheetOn, setNoInterestInfoBottomSheetOn] = useState(false); + const [cardCommissionBottomSheetOn, setCardCommissionBottomSheetOn] = useState(false); + const [creditCardListBottomSheetOn, setCreditCardListBottomSheetOn] = useState(false); const [cardCompany, setCardCompany] = useState('비씨'); const [cardCompanyOptions, setCardCompanyOptions] = useState>(); const [installmentDetails, setInstallmentDetails] = useState>([]); + const [settlementPeriod, setSettlementPeriod] = useState(); + const [generalTab, setGeneralTab] = useState(); + const [installmentTab, setInstallmentTab] = useState(); + const [moneyPointTab, setMoneyPointTab] = useState(); + + const [accountTransferData, setAccountTransferData] = useState(); + const [mobilePaymentData, setMobilePaymentData] = useState(); + const [otherPaymentData, setOtherPaymentData] = useState(); + + const [installmentData, setInstallmentData] = useState>(); + + const { mutateAsync: paymentCard } = usePaymentCardMutation(); + const { mutateAsync: paymentNonCard } = usePaymentNonCardMutation(); + const { mutateAsync: paymentInstallment } = usePaymentInstallmentMutation(); const { mutateAsync: paymentInstallmentDetail } = usePaymentInstallmentDetailMutation(); const list1 = [ @@ -98,20 +121,64 @@ export const InfoWrap = ({ 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 = () => { - let params = { + let params: PaymentInstallmentDetailParams = { mid: mid, cardCompany: cardCompany }; - paymentInstallmentDetail(params).then((rs) => { + paymentInstallmentDetail(params).then((rs: PaymentInstallmentDetailResponse) => { console.log(rs); setCardCompany(rs.cardCompany); setCardCompanyOptions(rs.cardCompanyOptions); setInstallmentDetails(rs.installmentDetails); }); }; - + useEffect(() => { + callPaymentCard(); + callPaymentNonCard(); + callPaymentIntallment(); + }, []); useEffect(() => { callPaymentIntallmentDetail(); }, [cardCompany]); @@ -129,6 +196,14 @@ export const InfoWrap = ({ { getList(PaymentInfoItemType.NoInterest) } + + { + const onClickToClose = () => { - // close setNoInterestInfoBottomSheetOn(false); }; diff --git a/src/pages/payment/info/info-page.tsx b/src/pages/payment/info/info-page.tsx index 2643cd5..b786a80 100644 --- a/src/pages/payment/info/info-page.tsx +++ b/src/pages/payment/info/info-page.tsx @@ -1,11 +1,9 @@ -import { useEffect, useState } from 'react'; +import { useState } from 'react'; import { PATHS } from '@/shared/constants/paths'; import { useNavigate } from '@/shared/lib/hooks/use-navigate'; import { PaymentTab } from '@/entities/payment/ui/payment-tab'; import { InfoWrap } from '@/entities/payment/ui/info-wrap'; -import { PaymentCardResponse, PaymentInstallmentResponse, PaymentNonCardResponse, 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 { PaymentTabKeys } from '@/entities/payment/model/types'; import { HeaderType } from '@/entities/common/model/types'; import { useSetHeaderTitle, @@ -13,22 +11,12 @@ import { useSetFooterMode, useSetOnBack } from '@/widgets/sub-layout/use-sub-layout'; -import { usePaymentInstallmentMutation } from '@/entities/payment/api/use-payment-installment-mutation'; export const InfoPage = () => { const { navigate } = useNavigate(); - const { mutateAsync: paymentCard } = usePaymentCardMutation(); - const { mutateAsync: paymentNonCard } = usePaymentNonCardMutation(); - const { mutateAsync: paymentInstallment } = usePaymentInstallmentMutation(); - const [activeTab, setActiveTab] = useState(PaymentTabKeys.Info); - const [mid, setMid] = useState('nictest00g'); - const [paymentCardResult, setPaymentCardResult] = useState(); - const [paymentNonCardResult, setPaymentNonCardResult] = useState(); - const [paymentInstallmentResult, setPaymentInstallResult] = useState(); - useSetHeaderTitle('결제 관리'); useSetHeaderType(HeaderType.LeftArrow); useSetFooterMode(true); @@ -36,58 +24,13 @@ export const InfoPage = () => { 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 ( <>
- +