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:
40
apps/backend/src/modules/payments/jobs/schedule.ts
Normal file
40
apps/backend/src/modules/payments/jobs/schedule.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { logger } from '@/logger';
|
||||
import { MarkOverduePayments } from './mark-overdue-payments';
|
||||
import { ReconcilePayments } from './reconcile-payments';
|
||||
|
||||
const RECONCILE_CRON = '*/15 * * * *';
|
||||
const OVERDUE_CRON = '4 4 * * *';
|
||||
|
||||
/**
|
||||
* Registers the payment background jobs. Called once from `server.ts`, following
|
||||
* the same guards as `startMpJobs`: Bun's in-process cron treats a rejected
|
||||
* promise as an unhandledRejection (which would crash the process), and `unref`
|
||||
* keeps the jobs from holding the process alive on their own.
|
||||
*/
|
||||
export function startPaymentJobs(): void {
|
||||
Bun.cron(
|
||||
RECONCILE_CRON,
|
||||
async () => {
|
||||
try {
|
||||
const totals = await new ReconcilePayments().execute();
|
||||
logger.info(totals, 'Mercado Pago payments reconciliation finished');
|
||||
} catch (error) {
|
||||
logger.error({ err: error }, 'Mercado Pago payments reconciliation failed');
|
||||
}
|
||||
},
|
||||
{ tz: 'UTC' },
|
||||
).unref();
|
||||
|
||||
Bun.cron(
|
||||
OVERDUE_CRON,
|
||||
async () => {
|
||||
try {
|
||||
const totals = await new MarkOverduePayments().execute();
|
||||
logger.info(totals, 'Overdue payments marked');
|
||||
} catch (error) {
|
||||
logger.error({ err: error }, 'Marking overdue payments failed');
|
||||
}
|
||||
},
|
||||
{ tz: 'UTC' },
|
||||
).unref();
|
||||
}
|
||||
Reference in New Issue
Block a user