feat: add country selection during onboarding and implement payment management features

- Introduced CountryStep component for selecting the country during onboarding, affecting payment currency.
- Updated FirstGroupStep to include country information.
- Enhanced PaymentsProvider to manage payment states and renewals.
- Created PaymentRow component for displaying individual payment details.
- Implemented PaymentsView for listing and filtering payments by group and status.
- Added API endpoints for fetching and creating payments, including batch processing.
- Defined payment schemas for validation and data handling.
- Updated GroupHeader and GroupDetailView to include charging functionality for group members.
This commit is contained in:
Jose Selesan
2026-10-08 11:42:13 -03:00
parent b11dd47534
commit 8c5caecdda
49 changed files with 2367 additions and 90 deletions

View File

@@ -0,0 +1,33 @@
import { z } from 'zod';
// Countries where Mercado Pago operates and Gruperly collects. The professor
// picks one during onboarding; it drives the currency of the payment links.
export const countryCodeSchema = z.enum(['AR', 'BR', 'CL', 'CO', 'MX', 'PE', 'UY']);
export type CountryCode = z.output<typeof countryCodeSchema>;
export const COUNTRY_CURRENCY: Record<CountryCode, string> = {
AR: 'ARS',
BR: 'BRL',
CL: 'CLP',
CO: 'COP',
MX: 'MXN',
PE: 'PEN',
UY: 'UYU',
};
export const COUNTRY_LABELS: Record<CountryCode, string> = {
AR: 'Argentina',
BR: 'Brasil',
CL: 'Chile',
CO: 'Colombia',
MX: 'México',
PE: 'Perú',
UY: 'Uruguay',
};
export const DEFAULT_COUNTRY: CountryCode = 'AR';
export const DEFAULT_CURRENCY = COUNTRY_CURRENCY[DEFAULT_COUNTRY];
export function currencyForCountry(country: CountryCode | null | undefined): string {
return country ? COUNTRY_CURRENCY[country] : DEFAULT_CURRENCY;
}