import moment from 'moment'; import { motion } from 'framer-motion'; import { DetailArrow } from '../detail-arrow'; import { InfoWrapKeys, DetailInfoProps, TransactionCategory } from '../../model/types'; import { NumericFormat } from 'react-number-format'; export const TransactionInfoWrap = ({ transactionCategory, transactionInfo, serviceCode, show, onClickToShowInfo }: DetailInfoProps) => { const subItems: Record> = { buyerName: {name: '구매자명', type: 'string'}, email: {name: '이메일', type: 'string'}, phoneNumber: {name: '전화번호', type: 'string'}, cancelReason: {name: '취소사유', type: 'string'}, cancelRequestor: {name: '취소요청자', type: 'string'}, partialCancel: {name: '부분취소', type: 'string'}, cashReceiptIssue: {name: '현금영수증발행', type: 'string'}, }; const showSubItems: Record> = { // 신용카드 '01': ['buyerName', 'email', 'phoneNumber', 'cancelReason', 'cancelRequestor', 'partialCancel'], // 계좌이체 '02': ['buyerName', 'email', 'phoneNumber', 'cancelReason', 'cancelRequestor', 'partialCancel', 'cashReceiptIssue'], // 가상계좌 '03': ['buyerName', 'email', 'phoneNumber', 'cancelReason', 'cancelRequestor', 'partialCancel', 'cashReceiptIssue'], // 휴대폰 '04': ['buyerName', 'email', 'phoneNumber', 'cancelReason', 'cancelRequestor'], // 계좌간편결제 '26': ['buyerName', 'email', 'phoneNumber', 'cancelReason', 'cancelRequestor', 'partialCancel', 'cashReceiptIssue'], // SSG머니 '21': ['buyerName', 'email', 'phoneNumber', 'cancelReason', 'cancelRequestor'], // SSG은행계좌 '24': ['buyerName', 'email', 'phoneNumber', 'cancelReason', 'cancelRequestor'], // 문화상품권 '14': ['buyerName', 'email', 'phoneNumber', 'cancelReason', 'cancelRequestor'], // 티머니페이 '31': ['buyerName', 'email', 'phoneNumber', 'cancelReason', 'cancelRequestor'], }; const checkValue = (val: any) => { return (!!val || val === 0); }; let newTransactionInfo: Record | undefined = transactionInfo; const subLi = () => { let rs = []; if(!!newTransactionInfo && !!serviceCode && !!showSubItems[serviceCode]){ for(let i=0;i ·  { subItems[k]?.name } { (checkValue(newTransactionInfo[k]) && subItems[k]?.type === 'string') && newTransactionInfo[k] } { (checkValue(newTransactionInfo[k]) && subItems[k]?.type === 'number') && } { (checkValue(newTransactionInfo[k]) && subItems[k]?.type === 'date') && moment(newTransactionInfo[k]).format('YYYY.MM.DD') } ); } } } return rs; }; const variants = { hidden: { height: 0, display: 'none' }, visible: { height: 'auto', display: 'block' }, }; const onClickToSetShowInfo = () => { if(!!onClickToShowInfo){ onClickToShowInfo(InfoWrapKeys.Transaction); } }; return ( <>
onClickToSetShowInfo() }>
거래 정보
{ (transactionCategory === TransactionCategory.AllTransaction) && subLi() } { (transactionCategory === TransactionCategory.Escrow) && <>
  • 가맹점명 NICE PAY
  • 사업자번호 123-45-67890
  • }
    ) };