All files / src/platform/auth/schemas payment.schema.ts

0% Statements 0/14
100% Branches 0/0
100% Functions 0/0
0% Lines 0/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32                                                               
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';
 
@Schema({ timestamps: true, collection: 'payments' })
export class Payment extends Document {
  @Prop({ required: true, index: true })
  tenantId: string;
 
  @Prop({ required: true })
  subscriptionId: string;
 
  @Prop({ required: true })
  amount: number; // Integer minor units (e.g. cents) for money, as required by Phase 5
 
  @Prop({ required: true, default: 'USD' })
  currency: string;
 
  @Prop({ required: true, default: 'PENDING' })
  status: string; // 'PENDING' | 'SUCCEEDED' | 'FAILED' | 'REFUNDED'
 
  @Prop({ required: true })
  gateway: string; // 'stripe' | 'razorpay'
 
  @Prop({ default: null })
  gatewayPaymentId: string;
 
  @Prop({ default: null })
  invoiceUrl: string;
}
 
export const PaymentSchema = SchemaFactory.createForClass(Payment);