Skip to content

Commit c560d83

Browse files
authored
Merge pull request #423 from PromptPlace/bug/#419
Bug/#419
2 parents d1dcd4c + d9e5215 commit c560d83

6 files changed

Lines changed: 6 additions & 46 deletions

File tree

prisma/schema.prisma

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,6 @@ model Payment {
419419
payment_id Int @id @default(autoincrement())
420420
purchase_id Int @unique
421421
status Status
422-
method PaymentMethod
423422
merchant_uid String @unique
424423
created_at DateTime @default(now())
425424
updated_at DateTime @updatedAt

src/purchases/repositories/purchase.complete.repository.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Prisma, PaymentMethod, Status } from '@prisma/client';
1+
import { Prisma, Status } from '@prisma/client';
22

33
type Tx = Prisma.TransactionClient;
44

@@ -15,8 +15,7 @@ export const PurchaseCompleteRepository = {
1515

1616
createPaymentTx(tx: Tx, data: {
1717
purchase_id: number;
18-
merchant_uid: string;
19-
method: PaymentMethod;
18+
merchant_uid: string;
2019
status: Status;
2120
paymentId: string;
2221
cash_receipt_url?: string | null;
@@ -27,7 +26,6 @@ export const PurchaseCompleteRepository = {
2726
purchase: { connect: { purchase_id: data.purchase_id } },
2827
merchant_uid: data.merchant_uid,
2928
imp_uid: data.paymentId,
30-
method: data.method,
3129
status: data.status,
3230
cash_receipt_url: data.cash_receipt_url,
3331
cash_receipt_type: data.cash_receipt_type,

src/purchases/services/purchase.complete.service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export const PurchaseCompleteService = {
4747
merchant_uid: paymentId,
4848
paymentId: paymentId,
4949
status: 'Succeed',
50-
method: verifiedPayment.method,
5150
cash_receipt_url: verifiedPayment.cashReceipt?.url,
5251
cash_receipt_type: verifiedPayment.cashReceipt?.type,
5352
});

src/purchases/services/purchase.webhook.service.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ export const WebhookService = {
5959
// 결제 생성
6060
const payment = await PurchaseCompleteRepository.createPaymentTx(tx, {
6161
purchase_id: purchase.purchase_id,
62-
merchant_uid: paymentId,
63-
method: verifiedPayment.method,
62+
merchant_uid: paymentId,
6463
cash_receipt_url: verifiedPayment.cashReceipt?.url,
6564
cash_receipt_type: verifiedPayment.cashReceipt?.type,
6665
status: 'Succeed',

src/purchases/utils/payment.util.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/purchases/utils/portone.ts

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import axios from 'axios';
22
import { AppError } from '../../errors/AppError';
3-
import { PaymentMethod } from '@prisma/client'
4-
import { normalizePaymentMethod } from "./payment.util"
53

64
interface PortOnePaymentResponse {
75
id: string; // paymentId
@@ -14,18 +12,6 @@ interface PortOnePaymentResponse {
1412
cancelled: number;
1513
};
1614
orderName: string;
17-
method?: {
18-
type: "PaymentMethodCard" | "PaymentMethodVirtualAccount" | "PaymentMethodEasyPay" | "PaymentMethodTransfer" | "PaymentMethodMobile"
19-
easyPay?: {
20-
provider: string;
21-
};
22-
card?: {
23-
publisher: string;
24-
};
25-
transfer?: { bank: string; };
26-
virtualAccount?: { bank: string; };
27-
mobile?: { carrier?: string; };
28-
};
2915
cashReceipt?: {
3016
type: "DEDUCTION" | "PROOF" | "NONE";
3117
url: string;
@@ -41,8 +27,7 @@ interface PortOnePaymentResponse {
4127
export type PortonePaymentVerified = {
4228
paymentId: string;
4329
amount: number;
44-
status: string;
45-
method: PaymentMethod;
30+
status: string;
4631
paidAt: Date;
4732
customData: any;
4833
cashReceipt?: {
@@ -100,11 +85,7 @@ export async function fetchAndVerifyPortonePayment(
10085
}
10186
}
10287

103-
// 5. 결제 수단 추출
104-
const rawMethodType = payment.method?.type || '';
105-
const method = normalizePaymentMethod(rawMethodType);
106-
107-
// 6. 현금영수증 데이터 추출
88+
// 5. 현금영수증 데이터 추출
10889
let cashReceiptInfo = null;
10990
if (payment.cashReceipt) {
11091
cashReceiptInfo = {
@@ -116,8 +97,7 @@ export async function fetchAndVerifyPortonePayment(
11697
return {
11798
paymentId: payment.id,
11899
amount: payment.amount.total,
119-
status: payment.status,
120-
method: method,
100+
status: payment.status,
121101
paidAt: payment.paidAt ? new Date(payment.paidAt) : new Date(),
122102
customData: parsedCustomData,
123103
cashReceipt: cashReceiptInfo

0 commit comments

Comments
 (0)