import moment from 'moment'; import { SectionTitleArrow } from '@/entities/common/ui/section-title-arrow'; import { InfoSectionKeys, InfoSectionProps, TransactionCategory } from '../../model/types'; import { NumericFormat } from 'react-number-format'; import { SlideDown } from 'react-slidedown'; import 'react-slidedown/lib/slidedown.css'; export const PaymentInfoSection = ({ transactionCategory, paymentInfo, serviceCode, isOpen, onClickToOpenInfo }: InfoSectionProps) => { const subItems: Record> = { approvalPurchase: {name: '승인매입', type: 'string'}, approvalRejectCount: {name: '승인반송(횟수)', type: 'number', addString: '건'}, approvalRepurchaseCount: {name: '승인재매입(횟수)', type: 'number', addString: '건'}, approvalVAN: {name: '승인VAN', type: 'string'}, cancelPurchase: {name: '취소매입', type: 'string'}, cancelRejectCount: {name: '취소반송', type: 'number', addString: '건'}, cancelRepurchaseCount: {name: '취소재매입', type: 'number', addString: '건'}, purchaseVan: {name: '매입VAN', type: 'string'}, purchaseCompany: {name: '매입사(발급사)', type: 'string'}, cardNo: {name: '카드번호', type: 'string'}, approvalNo: {name: '승인번호', type: 'string'}, installmentMonth: {name: '할부기간', type: 'string', addString: '개월'}, authentication: {name: '인증', type: 'string'}, joinType: {name: '유형', type: 'string'}, bankName: {name: '은행명', type: 'string'}, accountNo: {name: '계좌번호', type: 'string'}, refundCompleteDate: {name: '환불완료일', type: 'string'}, customerId: {name: '고객ID', type: 'string'}, culturelandId: {name: '컬처랜드ID', type: 'string'}, partner: {name: '제휴사', type: 'string'}, cpid: {name: 'CPID', type: 'string'}, goodsCategory: {name: '상품구분', type: 'string'}, cellphoneNo: {name: '휴대폰번호', type: 'string'}, giftCardNumber: {name: '상품권번호', type: 'string'}, depositBankName: {name: '입금금융기관명', type: 'string'}, depositorName: {name: '입금자명', type: 'string'}, depositDeadline: {name: '입금기한', type: 'date'}, depositDate: {name: '입금일', type: 'date'}, refundScheduleDate: {name: '환불예정일', type: 'date'}, refundBankName: {name: '환불은행명', type: 'string'}, refundAccountNo: {name: '환불계좌번호', type: 'string'}, accountHolder: {name: '예금주', type: 'string'}, }; const openSubItems: Record> = { // 신용카드 '01': ['approvalPurchase', 'approvalRejectCount', 'approvalRepurchaseCount', 'approvalVAN', 'cancelPurchase', 'cancelRejectCount', 'cancelRepurchaseCount', 'purchaseVan', 'purchaseCompany', 'cardNo', 'approvalNo', 'installmentMonth', 'authentication'], // 계좌이체 '02': ['joinType', 'bankName', 'accountNo'], // 가상계좌 '03': ['bankName', 'accountNo', 'depositBankName', 'depositorName', 'depositDeadline', 'depositDate', 'refundScheduleDate', 'refundBankName', 'refundAccountNo', 'accountHolder'], // 휴대폰 '05': ['refundCompleteDate', 'partner', 'cpid', 'goodsCategory', 'cellphoneNo'], // 문화상품권 '14': ['culturelandId'], // SSG머니 '21': ['giftCardNumber'], // SSG은행계좌 '24': [], // 계좌간편결제 '26': ['bankName', 'refundCompleteDate', 'accountHolder', 'joinType', 'customerId'], // 티머니페이 '31': ['cardNo', 'approvalNo', 'cpid'], }; const checkValue = (val: any) => { return (!!val || val === 0); }; let newPaymentInfo: Record | undefined = paymentInfo; const subLi = () => { let rs = []; if(!!newPaymentInfo && !!serviceCode && !!openSubItems[serviceCode]){ for(let i=0;i ·  { subItems[k]?.name } { (checkValue(newPaymentInfo[k]) && subItems[k]?.type === 'string') && (k === 'installmentMonth' && newPaymentInfo[k] === '00') && '일시불' } { (checkValue(newPaymentInfo[k]) && subItems[k]?.type === 'string') && (k === 'installmentMonth' && newPaymentInfo[k] !== '00') && newPaymentInfo[k] + (subItems[k]?.addString || '') } { (checkValue(newPaymentInfo[k]) && subItems[k]?.type === 'string') && ( k!== 'installmentMonth' ) && newPaymentInfo[k] + (subItems[k]?.addString || '') } { (checkValue(newPaymentInfo[k]) && subItems[k]?.type === 'number') && } { (checkValue(newPaymentInfo[k]) && subItems[k]?.type === 'date') && moment(newPaymentInfo[k]).format('YYYY.MM.DD') } ); } } } return rs; }; const onClickToSetOpenInfo = () => { if(!!onClickToOpenInfo){ onClickToOpenInfo(InfoSectionKeys.Payment); } }; return ( <>
onClickToSetOpenInfo() } > 결제 정보
{ !!isOpen &&
    { (transactionCategory === TransactionCategory.AllTransaction) && subLi() } { (transactionCategory === TransactionCategory.Escrow) && <>
  • ·  승인매입 { }
  • ·  승인반송(횟수) { }
  • ·  승인재매입(횟수) { }
  • ·  승인VAN { }
  • ·  취소매입 { }
  • ·  취소반송 { }
  • ·  취소재매입 { }
  • ·  매입VAN { }
  • ·  매입사(발급사) { }
  • ·  카드번호 { }
  • ·  승인번호 { }
  • ·  할부기간 { }
  • ·  인증 { }
  • ·  유형 { }
  • ·  은행명 { }
  • ·  계좌번호 { }
  • ·  입금금융기관명 { }
  • ·  입금자명 { }
  • ·  입금기한 { }
  • ·  입금일 { }
  • ·  환불예정일 { }
  • ·  환불은행명 { }
  • ·  환불계좌번호 { }
  • ·  예금주 { }
  • }
}
) };