11import axios from 'axios' ;
22import { AppError } from '../../errors/AppError' ;
3- import { PaymentMethod } from '@prisma/client'
4- import { normalizePaymentMethod } from "./payment.util"
53
64interface 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 {
4127export 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