use chrono::{DateTime, Utc}; use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; use uuid::Uuid; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, DeriveEntityModel)] #[sea_orm(table_name = "app_payments")] pub struct Model { #[sea_orm(primary_key, default = "gen_random_uuid()", auto_increment = false)] pub id: Uuid, #[sea_orm(column_type = "Uuid")] pub session_id: Uuid, #[sea_orm(column_type = "Uuid")] pub mentee_id: Uuid, #[sea_orm(column_type = "Uuid")] pub mentor_id: Uuid, #[sea_orm(column_type = "BigInteger", default = 0)] pub amount: i64, #[sea_orm(column_type = "BigInteger", default = 0)] pub service_fee: i64, #[sea_orm(column_type = "BigInteger", default = 0)] pub total: i64, // payment method: "va" | "qris" | "manual" #[sea_orm(default = "manual")] pub method: String, // payment provider: "manual" | "midtrans" | "xendit" (swap later) #[sea_orm(default = "manual")] pub provider: String, // status: "pending" | "paid" | "expired" | "cancelled" #[sea_orm(default = "pending")] pub status: String, // provider reference: VA number / QR string / external transaction id #[sea_orm(nullable)] pub external_ref: Option, // provider order id (Midtrans order_id, e.g. "DM-") used to query status #[sea_orm(nullable)] pub provider_order_id: Option, #[sea_orm(nullable)] pub paid_at: Option>, #[sea_orm(not_null)] pub expires_at: DateTime, #[sea_orm(not_null, default = "now()")] pub created_at: DateTime, #[sea_orm(not_null, default = "now()")] pub updated_at: DateTime, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation {} impl ActiveModelBehavior for ActiveModel {}