Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -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
7 changes: 6 additions & 1 deletion .github/workflows/deploy-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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: |
Expand Down
1 change: 0 additions & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions src/purchases/repositories/purchase.complete.repository.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Prisma, PaymentMethod, Status } from '@prisma/client';
import { Prisma, Status } from '@prisma/client';

type Tx = Prisma.TransactionClient;

Expand All @@ -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;
Expand All @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/purchases/services/purchase.complete.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
3 changes: 1 addition & 2 deletions src/purchases/services/purchase.webhook.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
15 changes: 0 additions & 15 deletions src/purchases/utils/payment.util.ts

This file was deleted.

26 changes: 3 additions & 23 deletions src/purchases/utils/portone.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -41,8 +27,7 @@ interface PortOnePaymentResponse {
export type PortonePaymentVerified = {
paymentId: string;
amount: number;
status: string;
method: PaymentMethod;
status: string;
paidAt: Date;
customData: any;
cashReceipt?: {
Expand Down Expand Up @@ -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 = {
Expand All @@ -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
Expand Down