Files
pagodera/types/donation.ts
T
Evandro Fonseca Junior e30d9493ff feat: enhance donation creation logging and adjust amount limits
- Add detailed secure logging throughout the donation creation API route for production debugging, including request receipt, validation results, amount calculations, PIX creation success, and error handling
- Update custom donation amount schema to allow minimum 0.01 and maximum 100,000 for broader donation flexibility
- Modify secure logger to always output data in production for improved monitoring and troubleshooting
2025-10-26 23:24:46 -03:00

98 lines
1.8 KiB
TypeScript

export interface DonationTier {
id: string;
amount?: number;
title: string;
description: string;
icon: "coffee" | "pizza" | "heart";
badge?: string;
highlighted?: boolean;
}
export interface DonationData {
amount: number;
donorName?: string;
donorEmail?: string;
message?: string;
}
export const DONATION_PRODUCTS = {
coffee: {
id: "prod_6ryJmhfZGNJGjNaYaA1YqhDn",
name: "Doação Café",
amount: 5,
price: 500, // centavos
},
snack: {
id: "prod_FpLxKWgmHXbj2Ghwxa0BsFph",
name: "Doação Lanche",
amount: 10,
price: 1000,
},
lunch: {
id: "prod_czgg0YjKBp3GpsFYpSp3M1TZ",
name: "Doação Almoço",
amount: 25,
price: 2500,
},
custom: {
id: "custom",
name: "Valor Personalizado",
amount: 0,
price: 0,
minAmount: 0.01, // R$ 0,01
maxAmount: 100000, // R$ 100.000,00
},
} as const;
export type DonationTierId = keyof typeof DONATION_PRODUCTS;
export interface DonorData {
name: string;
phone: string;
email?: string;
message?: string;
}
export interface DonationResponse {
success: boolean;
pixId?: string;
brCode?: string;
brCodeBase64?: string;
expiresAt?: string;
error?: string;
}
export interface BillingStatus {
id: string;
amount: number;
status: "PENDING" | "PAID" | "EXPIRED" | "CANCELLED";
pixCode: string;
pixQrCode: string;
expiresAt: string;
createdAt: string;
}
export interface DonationStats {
totalSupporters: number;
totalRaised: number;
monthsOnline: number;
uptime: number;
}
export interface TransparencyData {
hosting: number;
development: number;
support: number;
emergency: number;
}
export interface Supporter {
id: string;
name: string;
avatar?: string;
amount: number;
message?: string;
createdAt: string;
anonymous?: boolean;
}