From d9e521526d9ec16100d20474aae4d7c53d072e05 Mon Sep 17 00:00:00 2001 From: minij02 Date: Tue, 24 Feb 2026 20:54:56 +0900 Subject: [PATCH 1/2] Refactor: Remove payment method logic --- prisma/schema.prisma | 1 - .../purchase.complete.repository.ts | 6 ++--- .../services/purchase.complete.service.ts | 1 - .../services/purchase.webhook.service.ts | 3 +-- src/purchases/utils/payment.util.ts | 15 ----------- src/purchases/utils/portone.ts | 26 +++---------------- 6 files changed, 6 insertions(+), 46 deletions(-) delete mode 100644 src/purchases/utils/payment.util.ts diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 7988cec..81ff374 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -419,7 +419,6 @@ model Payment { payment_id Int @id @default(autoincrement()) purchase_id Int @unique status Status - method PaymentMethod merchant_uid String @unique created_at DateTime @default(now()) updated_at DateTime @updatedAt diff --git a/src/purchases/repositories/purchase.complete.repository.ts b/src/purchases/repositories/purchase.complete.repository.ts index 3fe2b2f..23660d1 100644 --- a/src/purchases/repositories/purchase.complete.repository.ts +++ b/src/purchases/repositories/purchase.complete.repository.ts @@ -1,4 +1,4 @@ -import { Prisma, PaymentMethod, Status } from '@prisma/client'; +import { Prisma, Status } from '@prisma/client'; type Tx = Prisma.TransactionClient; @@ -15,8 +15,7 @@ export const PurchaseCompleteRepository = { createPaymentTx(tx: Tx, data: { purchase_id: number; - merchant_uid: string; - method: PaymentMethod; + merchant_uid: string; status: Status; paymentId: string; cash_receipt_url?: string | null; @@ -27,7 +26,6 @@ export const PurchaseCompleteRepository = { purchase: { connect: { purchase_id: data.purchase_id } }, merchant_uid: data.merchant_uid, imp_uid: data.paymentId, - method: data.method, status: data.status, cash_receipt_url: data.cash_receipt_url, cash_receipt_type: data.cash_receipt_type, diff --git a/src/purchases/services/purchase.complete.service.ts b/src/purchases/services/purchase.complete.service.ts index 850dd76..83a02eb 100644 --- a/src/purchases/services/purchase.complete.service.ts +++ b/src/purchases/services/purchase.complete.service.ts @@ -47,7 +47,6 @@ export const PurchaseCompleteService = { merchant_uid: paymentId, paymentId: paymentId, status: 'Succeed', - method: verifiedPayment.method, cash_receipt_url: verifiedPayment.cashReceipt?.url, cash_receipt_type: verifiedPayment.cashReceipt?.type, }); diff --git a/src/purchases/services/purchase.webhook.service.ts b/src/purchases/services/purchase.webhook.service.ts index b306ac3..8974309 100644 --- a/src/purchases/services/purchase.webhook.service.ts +++ b/src/purchases/services/purchase.webhook.service.ts @@ -59,8 +59,7 @@ export const WebhookService = { // 결제 생성 const payment = await PurchaseCompleteRepository.createPaymentTx(tx, { purchase_id: purchase.purchase_id, - merchant_uid: paymentId, - method: verifiedPayment.method, + merchant_uid: paymentId, cash_receipt_url: verifiedPayment.cashReceipt?.url, cash_receipt_type: verifiedPayment.cashReceipt?.type, status: 'Succeed', diff --git a/src/purchases/utils/payment.util.ts b/src/purchases/utils/payment.util.ts deleted file mode 100644 index 0094970..0000000 --- a/src/purchases/utils/payment.util.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { PaymentMethod, PaymentProvider } from '@prisma/client'; -import { AppError } from '../../errors/AppError'; - -// 결제 수단 매핑 -export function normalizePaymentMethod(input: string): PaymentMethod { - const code = input.toUpperCase().replace(/\s+/g, ''); - - if (code === 'PaymentMethodCard') return 'CARD'; - if (code === 'PaymentMethodVirtualAccount') return 'VIRTUAL_ACCOUNT'; - if (code === 'PaymentMethodEasyPay') return 'TRANSFER'; - if (code === 'PaymentMethodTransfer') return 'MOBILE'; - if (code === 'PaymentMethodMobile') return 'EASY_PAY'; - - throw new AppError(`지원하지 않는 결제 수단입니다: ${input}`, 400, 'UnsupportedPaymentMethod'); -} \ No newline at end of file diff --git a/src/purchases/utils/portone.ts b/src/purchases/utils/portone.ts index 1d6a6ff..ae87b41 100644 --- a/src/purchases/utils/portone.ts +++ b/src/purchases/utils/portone.ts @@ -1,7 +1,5 @@ import axios from 'axios'; import { AppError } from '../../errors/AppError'; -import { PaymentMethod } from '@prisma/client' -import { normalizePaymentMethod } from "./payment.util" interface PortOnePaymentResponse { id: string; // paymentId @@ -14,18 +12,6 @@ interface PortOnePaymentResponse { cancelled: number; }; orderName: string; - method?: { - type: "PaymentMethodCard" | "PaymentMethodVirtualAccount" | "PaymentMethodEasyPay" | "PaymentMethodTransfer" | "PaymentMethodMobile" - easyPay?: { - provider: string; - }; - card?: { - publisher: string; - }; - transfer?: { bank: string; }; - virtualAccount?: { bank: string; }; - mobile?: { carrier?: string; }; - }; cashReceipt?: { type: "DEDUCTION" | "PROOF" | "NONE"; url: string; @@ -41,8 +27,7 @@ interface PortOnePaymentResponse { export type PortonePaymentVerified = { paymentId: string; amount: number; - status: string; - method: PaymentMethod; + status: string; paidAt: Date; customData: any; cashReceipt?: { @@ -100,11 +85,7 @@ export async function fetchAndVerifyPortonePayment( } } - // 5. 결제 수단 추출 - const rawMethodType = payment.method?.type || ''; - const method = normalizePaymentMethod(rawMethodType); - - // 6. 현금영수증 데이터 추출 + // 5. 현금영수증 데이터 추출 let cashReceiptInfo = null; if (payment.cashReceipt) { cashReceiptInfo = { @@ -116,8 +97,7 @@ export async function fetchAndVerifyPortonePayment( return { paymentId: payment.id, amount: payment.amount.total, - status: payment.status, - method: method, + status: payment.status, paidAt: payment.paidAt ? new Date(payment.paidAt) : new Date(), customData: parsedCustomData, cashReceipt: cashReceiptInfo From 274f86d158a116a9fc273e1d81d77618db2d53b7 Mon Sep 17 00:00:00 2001 From: minij02 Date: Tue, 24 Feb 2026 22:49:00 +0900 Subject: [PATCH 2/2] CI: Add .dockerignore and EC2 disk cleanup step to dev workflow --- .dockerignore | 30 ++++++++++++++++++++++++++++ .github/workflows/deploy-develop.yml | 7 ++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8399d2f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,30 @@ +# 의존성 및 빌드 결과물 +node_modules +dist +build +coverage + +# 깃 관련 파일 +.git +.gitignore + +# 환경 변수 +.env +.env.dev + +# 로그 파일 +npm-debug.log +yarn-error.log +pnpm-debug.log + +# 불필요한 OS 생성 파일 +.DS_Store +Thumbs.db + +# 도커 관련 파일 +Dockerfile +docker-compose.yml +.dockerignore + +# 빌드에 필요 없는 파일 +README.md \ No newline at end of file diff --git a/.github/workflows/deploy-develop.yml b/.github/workflows/deploy-develop.yml index 801855a..382094e 100644 --- a/.github/workflows/deploy-develop.yml +++ b/.github/workflows/deploy-develop.yml @@ -50,7 +50,7 @@ jobs: - name: Install, Generate & Build on server run: | - ssh prod 'cd /opt/app-dev && pnpm install --frozen-lockfile && pnpm exec prisma generate' + ssh prod 'cd /opt/app-dev && pnpm install --frozen-lockfile && pnpm exec prisma generate && rm -rf dist && pnpm build' # 테스트 DB 마이그레이션 - name: Run Prisma DB Push (Dev) @@ -63,6 +63,11 @@ jobs: pnpm exec prisma db push EOF + # 도커 빌드 전 디스크 용량 확보 + - name: Clean up unused Docker data on EC2 + run: | + ssh prod 'sudo docker system prune -af' + # app-dev 컨테이너만 재시작 (운영 컨테이너 app, caddy는 건드리지 않음) - name: Deploy Docker services (Dev) run: |