결제, 구독 기능
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
const { DataTypes } = require('sequelize');
|
||||
const { sequelize } = require('../config/database');
|
||||
|
||||
const PaymentRequest = sequelize.define('PaymentRequest', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
comment: '결제 요청 고유 ID'
|
||||
},
|
||||
clubId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
comment: '클럽 ID'
|
||||
},
|
||||
planId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: true,
|
||||
comment: '선택한 구독 플랜 ID'
|
||||
},
|
||||
currentPlanId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: true,
|
||||
comment: '현재 구독 중인 플랜 ID'
|
||||
},
|
||||
isUpgrade: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
defaultValue: false,
|
||||
comment: '업그레이드 여부 (true: 업그레이드, false: 다운그레이드 또는 신규)'
|
||||
},
|
||||
planDuration: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 1,
|
||||
comment: '구독 기간 (개월 단위)'
|
||||
},
|
||||
features: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: true,
|
||||
comment: '추가 기능 목록 (JSON 문자열)'
|
||||
},
|
||||
totalAmount: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
comment: '총 결제 금액 (원)'
|
||||
},
|
||||
status: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
defaultValue: 'pending',
|
||||
comment: '결제 상태 (pending: 대기, success: 성공, failed: 실패, cancelled: 취소)'
|
||||
},
|
||||
orderId: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
comment: '주문 고유 ID'
|
||||
},
|
||||
paymentKey: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
comment: '결제 서비스 제공자의 결제 키'
|
||||
},
|
||||
paymentData: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: true,
|
||||
comment: '결제 관련 추가 데이터 (JSON 문자열)'
|
||||
},
|
||||
planChange: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
defaultValue: false,
|
||||
comment: '플랜 변경 여부 (true: 플랜 변경, false: 신규 구독 또는 기능만 추가)'
|
||||
},
|
||||
failReason: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
comment: '결제 실패 사유'
|
||||
}
|
||||
}, {
|
||||
timestamps: true
|
||||
});
|
||||
|
||||
module.exports = PaymentRequest;
|
||||
Reference in New Issue
Block a user