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

@@ -16,6 +16,8 @@ import type {
CreateFirstGroupResult,
CreateGroupResult,
CreateGroupWaitlistEntry,
CreatePaymentsBatch,
CreatePaymentsBatchResult,
GroupAnalytics,
GroupDto,
GroupInviteInfoDto,
@@ -38,6 +40,9 @@ import type {
NotifyAbsence,
NotifyAbsenceResult,
OnboardingStatusDto,
PaymentDto,
PaymentList,
PaymentQuery,
ProblemDetails,
PromoteGroupWaitlistEntryResult,
PublicNotifyAbsence,
@@ -119,6 +124,27 @@ export const getMpStatus = () => apiFetch<MpStatusDto>('/api/v1/mp/status')
export const disconnectMp = () =>
apiFetch<MpDisconnectResultDto>('/api/v1/mp/connect', { method: 'DELETE' })
// — Cobros —
export const getPayments = (params: PaymentQuery) => {
const query = new URLSearchParams({
page: String(params.page ?? 1),
pageSize: String(params.pageSize ?? 20),
})
if (params.groupId) query.set('groupId', params.groupId)
if (params.status) query.set('status', params.status)
return apiFetch<PaymentList>(`/api/v1/payments?${query.toString()}`)
}
export const createPaymentsBatch = (groupId: string, payload: CreatePaymentsBatch) =>
apiFetch<CreatePaymentsBatchResult>(`/api/v1/groups/${groupId}/payments/batch`, {
method: 'POST',
body: JSON.stringify(payload),
})
export const renewPaymentLink = (paymentId: string) =>
apiFetch<PaymentDto>(`/api/v1/payments/${paymentId}/renew`, { method: 'POST' })
/* The groups screen has no pagination: we ask for the maximum allowed so no
group is left out of the listing, and for the browser time zone so the
backend sorts by the next class in the person's local time. */