feat(payments): automatic monthly charges with combined links per payer

- Teacher picks a day of the month in Settings; an hourly job creates the
  fees of all monthly groups on that day in the teacher's time zone
  (one run per teacher and month, partial unique index per attendee/period).
- One Mercado Pago link per payer (PaymentCheckout): the adult in charge
  bundles their kids and their own fees; external_reference chk_<id>,
  dedicated webhook and reconciliation mark every fee PAID at once.
- Person.payWithMercadoPago toggle (default on): off creates the fee
  without a link so the student pays by transfer.
- A fee paid some other way supersedes its combined link and expires the
  preference; renewing rebuilds the combined link or a single one.
- Optional WhatsApp delivery (PAYMENT_LINK kind, new Kapso template);
  weekly reminders now go once per combined link.
- Web: auto charge settings card, per-student toggle, combined link label
  in Cobros and "Pay all" in the student app, in the four locales.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jose Selesan
2026-11-11 15:08:48 -03:00
parent 5b3a035dcf
commit ac98495a6e
87 changed files with 2648 additions and 106 deletions

View File

@@ -1,11 +1,11 @@
import { Badge, useToast } from '../../components/ui'
import { Badge, Switch, useToast } from '../../components/ui'
import { paymentPresentation } from './detail'
import { Section } from './Section'
import { useAttendeeDetail } from './AttendeeDetailProvider'
import { useTranslation } from 'react-i18next'
export function AttendeePaymentsSection() {
const { attendee } = useAttendeeDetail()
const { attendee, saveAttendee, isUpdatingAttendee } = useAttendeeDetail()
const toast = useToast()
const { t } = useTranslation(['attendeeDetail', 'common'])
if (!attendee) return null
@@ -17,6 +17,16 @@ export function AttendeePaymentsSection() {
toast.info(t('payments.registerPending'))
}
// Es de la persona: cambia en todos sus grupos, como el contacto.
const togglePayWithMp = async (payWithMercadoPago: boolean) => {
try {
await saveAttendee({ payWithMercadoPago })
toast.success(payWithMercadoPago ? t('payments.payWithMpOn') : t('payments.payWithMpOff'))
} catch {
toast.error(t('payments.payWithMpError'))
}
}
return (
<Section title={t('payments.title')}>
<div className="flex min-h-14 items-center justify-between gap-3 px-3 py-1">
@@ -36,6 +46,21 @@ export function AttendeePaymentsSection() {
{t('payments.register')}
</button>
</div>
<div className="flex items-start justify-between gap-3 border-t border-border px-3 py-3">
<div className="min-w-0">
<p className="text-sm text-primary">{t('payments.payWithMp')}</p>
<p id="pay-with-mp-hint" className="text-xs text-secondary">
{t('payments.payWithMpHint')}
</p>
</div>
<Switch
checked={attendee.payWithMercadoPago}
disabled={isUpdatingAttendee}
aria-label={t('payments.payWithMp')}
aria-describedby="pay-with-mp-hint"
onCheckedChange={togglePayWithMp}
/>
</div>
</Section>
)
}

View File

@@ -49,6 +49,11 @@ export function PaymentRow({ payment, showGroup, isRenewing, onRenew }: PaymentR
<span className="text-xs text-foreground/50">{paymentPeriodLabel(payment)}</span>
</p>
<p className="mt-1 text-xs text-foreground/50">{paymentDateLabel(payment)}</p>
{payment.checkoutItemCount && payment.checkoutItemCount > 1 ? (
<p className="mt-1 text-xs text-foreground/50">
{t('row.combined', { count: payment.checkoutItemCount })}
</p>
) : null}
</div>
<Badge variant={PAYMENT_STATUS_BADGE[payment.status]}>
{paymentStatusLabel(payment.status)}

View File

@@ -10,7 +10,20 @@ export const PAYMENT_STATUS_BADGE: Record<PaymentDto['status'], BadgeVariant> =
}
export function paymentPeriodLabel(payment: PaymentDto): string {
return payment.description ?? payment.groupName
if (payment.description) return payment.description
if (payment.periodKey) return periodKeyLabel(payment.periodKey)
return payment.groupName
}
/* "2026-12" → "Diciembre 2026", en el idioma de la UI. */
export function periodKeyLabel(periodKey: string): string {
const [year, month] = periodKey.split('-').map(Number)
const text = new Date(Date.UTC(year ?? 2000, (month ?? 1) - 1, 15)).toLocaleDateString(i18n.language, {
month: 'long',
year: 'numeric',
timeZone: 'UTC',
})
return text.charAt(0).toUpperCase() + text.slice(1)
}
export function paymentDateLabel(payment: PaymentDto): string {

View File

@@ -0,0 +1,207 @@
import { useState } from 'react'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import type { AutoChargeSettingsDto, PaymentRunDto, UpdateAutoChargeSettings } from '@gruperly/shared'
import { AUTO_CHARGE_MAX_DAY } from '@gruperly/shared'
import { CalendarClock } from 'lucide-react'
import { useTranslation } from 'react-i18next'
import { Badge, Label, Switch, useToast } from '../../components/ui'
import { useIntlLocale } from '../../i18n'
import { errorMessage } from '../../i18n/errors'
import { getAutoChargeSettings, updateAutoChargeSettings } from '../../lib/api'
import { hasPlanFeature, useBillingStatus } from '../billing'
import { useMpStatus } from '../mp'
import { automationBlockedReason, useWhatsappStatus } from '../whatsapp'
export const autoChargeQueryKey = ['auto-charge'] as const
const DAYS = Array.from({ length: AUTO_CHARGE_MAX_DAY }, (_, index) => index + 1)
const DUE_OPTIONS = [3, 5, 7, 10, 15, 20, 30] as const
const selectClass =
'h-11 w-full rounded-xl border border-border bg-surface px-3 text-base text-primary sm:text-sm focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/30 disabled:opacity-50'
/*
* Cobro automático: el día del mes en que se generan las cuotas de todos los
* grupos mensuales, con un link de Mercado Pago por quien paga (el adulto a
* cargo junta a sus chicos), y si esos links salen por WhatsApp.
*/
export function AutoChargeSettingsCard() {
const { t } = useTranslation(['settings', 'common'])
const locale = useIntlLocale()
const toast = useToast()
const queryClient = useQueryClient()
const query = useQuery({ queryKey: autoChargeQueryKey, queryFn: getAutoChargeSettings })
const mpQuery = useMpStatus()
const whatsappQuery = useWhatsappStatus()
const billingQuery = useBillingStatus()
// Solo al prenderlo a mano aparece el formulario: ahí va el foco.
const [justEnabled, setJustEnabled] = useState(false)
const mutation = useMutation({
mutationFn: updateAutoChargeSettings,
onSuccess: (data) => {
queryClient.setQueryData<AutoChargeSettingsDto>(autoChargeQueryKey, data)
toast.success(t('autoCharge.saved'))
},
onError: (error) => toast.error(errorMessage(error, t('autoCharge.saveError'))),
})
const settings = query.data
const includedInPlan = hasPlanFeature(billingQuery.data, 'mpCharges')
const whatsappInPlan = hasPlanFeature(billingQuery.data, 'whatsappAutomations')
const mpLinked = mpQuery.data?.status === 'active'
const whatsappBlocked = automationBlockedReason(whatsappQuery.data, 'PAYMENT_LINK')
const busy = mutation.isPending || query.isPending
const save = (patch: UpdateAutoChargeSettings) => mutation.mutate(patch)
const formatDay = (isoDay: string) =>
new Date(`${isoDay}T12:00:00Z`).toLocaleDateString(locale, { day: 'numeric', month: 'long', timeZone: 'UTC' })
return (
<section className="rounded-xl border border-border bg-surface" aria-labelledby="auto-charge-title">
<div className="flex items-start gap-3 px-4 py-3">
<span className="rounded-lg bg-accent-soft p-2" aria-hidden="true">
<CalendarClock className="size-4 text-accent-fg" />
</span>
<div className="min-w-0 flex-1">
<p id="auto-charge-title" className="flex items-center gap-2 text-sm font-medium text-primary">
{t('autoCharge.title')}
{includedInPlan ? null : <Badge variant="info">Pro</Badge>}
</p>
<p id="auto-charge-description" className="text-xs text-secondary">
{t('autoCharge.description')}
</p>
{!mpLinked && !settings?.enabled ? (
<p className="mt-1 text-xs text-warning">{t('autoCharge.needsMp')}</p>
) : null}
</div>
<Switch
checked={settings?.enabled ?? false}
disabled={busy || (!settings?.enabled && (!includedInPlan || !mpLinked))}
aria-label={t('autoCharge.title')}
aria-describedby="auto-charge-description"
onCheckedChange={(enabled) => {
setJustEnabled(enabled)
save({ enabled })
}}
/>
</div>
{settings?.enabled ? (
<div className="space-y-4 border-t border-border px-4 py-4">
<div className="grid grid-cols-2 gap-3">
<div className="space-y-1.5">
<Label htmlFor="auto-charge-day">{t('autoCharge.day')}</Label>
<select
id="auto-charge-day"
autoFocus={justEnabled}
className={selectClass}
value={settings.chargeDay}
disabled={busy}
onChange={(event) => save({ chargeDay: Number(event.target.value) })}
>
{DAYS.map((day) => (
<option key={day} value={day}>
{t('autoCharge.dayOption', { day })}
</option>
))}
</select>
</div>
<div className="space-y-1.5">
<Label htmlFor="auto-charge-due">{t('autoCharge.due')}</Label>
<select
id="auto-charge-due"
className={selectClass}
value={settings.dueInDays}
disabled={busy}
onChange={(event) => save({ dueInDays: Number(event.target.value) })}
>
{(DUE_OPTIONS.includes(settings.dueInDays as (typeof DUE_OPTIONS)[number])
? DUE_OPTIONS
: [...DUE_OPTIONS, settings.dueInDays].sort((a, b) => a - b)
).map((days) => (
<option key={days} value={days}>
{t('autoCharge.dueOption', { count: days })}
</option>
))}
</select>
</div>
</div>
<div className="flex items-start gap-3">
<div className="min-w-0 flex-1">
<p className="flex items-center gap-2 text-sm text-primary">
{t('autoCharge.whatsapp')}
{whatsappInPlan ? null : <Badge variant="info">Pro</Badge>}
</p>
<p id="auto-charge-whatsapp-hint" className="text-xs text-secondary">
{t('autoCharge.whatsappDescription')}
{whatsappBlocked && !settings.sendWhatsapp ? (
<>
{' '}
<span className="text-warning">{whatsappBlocked}</span>
</>
) : null}
</p>
</div>
<Switch
checked={settings.sendWhatsapp}
disabled={busy || (!settings.sendWhatsapp && (whatsappBlocked !== null || !whatsappInPlan))}
aria-label={t('autoCharge.whatsapp')}
aria-describedby="auto-charge-whatsapp-hint"
onCheckedChange={(sendWhatsapp) => save({ sendWhatsapp })}
/>
</div>
<p className="text-xs text-secondary">{t('autoCharge.howItGroups')}</p>
{settings.nextRunDate ? (
<p className="text-sm text-primary">{t('autoCharge.next', { date: formatDay(settings.nextRunDate) })}</p>
) : null}
</div>
) : null}
{settings?.lastRun ? <LastRun run={settings.lastRun} /> : null}
</section>
)
}
function LastRun({ run }: { run: PaymentRunDto }) {
const { t } = useTranslation('settings')
const locale = useIntlLocale()
const [year, month] = run.periodKey.split('-').map(Number)
const period = new Date(Date.UTC(year ?? 2000, (month ?? 1) - 1, 15)).toLocaleDateString(locale, {
month: 'long',
year: 'numeric',
timeZone: 'UTC',
})
let summary: string
if (run.status === 'SKIPPED') {
summary = t(`autoCharge.skipped.${skipReasonKey(run.skipReason)}`)
} else if (run.status === 'RUNNING') {
summary = t('autoCharge.running')
} else {
summary = [
t('autoCharge.fees', { count: run.fees }),
t('autoCharge.links', { count: run.linked }),
run.failed > 0 ? t('autoCharge.failed', { count: run.failed }) : null,
run.sent > 0 ? t('autoCharge.sent', { count: run.sent }) : null,
]
.filter(Boolean)
.join(' · ')
}
return (
<p className="border-t border-border px-4 py-3 text-xs text-secondary">
{t('autoCharge.lastRun', { period })} {summary}
</p>
)
}
const SKIP_REASONS = ['mp_not_connected', 'plan_feature_required', 'no_groups'] as const
function skipReasonKey(reason: string | null): (typeof SKIP_REASONS)[number] | 'other' {
return SKIP_REASONS.find((known) => known === reason) ?? 'other'
}

View File

@@ -7,6 +7,7 @@ import { PlanSettingsCard } from '../billing'
import { MpStatusCard } from '../mp'
import { WhatsappStatusCard } from '../whatsapp'
import { AppearanceCard } from './AppearanceCard'
import { AutoChargeSettingsCard } from './AutoChargeSettingsCard'
import { LanguageCard } from './LanguageCard'
import { TransferDetailsSettingsCard } from './TransferDetailsSettingsCard'
import { useCallbackFeedbackToast } from './useCallbackFeedbackToast'
@@ -46,6 +47,8 @@ export function SettingsView() {
<MpStatusCard />
<AutoChargeSettingsCard />
<TransferDetailsSettingsCard />
<WhatsappStatusCard />

View File

@@ -3,7 +3,7 @@ import type { StudentFee } from '@gruperly/shared'
import { ExternalLink, Receipt } from 'lucide-react'
import { Badge } from '../../components/ui'
import { formatPrice } from '../../lib/format'
import { feeLabel } from './format'
import { checkoutItemsLabel, feeLabel } from './format'
import { FeeStatusBadge } from './FeeStatusBadge'
import { useTranslation } from 'react-i18next'
@@ -40,10 +40,19 @@ export function FeeCard({ fees }: { fees: StudentFee[] }) {
{toReport.length > 0 ? (
<div className="mt-4 space-y-2">
{single ? (
<a href={single.checkoutUrl ?? undefined} target="_blank" rel="noreferrer" className={primary}>
{t('fee.payMp')}
<ExternalLink className="size-4" aria-hidden="true" />
</a>
<>
<a href={single.checkoutUrl ?? undefined} target="_blank" rel="noreferrer" className={primary}>
{single.checkout
? t('fee.payAll', { amount: formatPrice(single.checkout.total, single.currency) })
: t('fee.payMp')}
<ExternalLink className="size-4" aria-hidden="true" />
</a>
{single.checkout ? (
<p className="text-center text-xs text-secondary">
{t('fee.includes', { items: checkoutItemsLabel(single.checkout) })}
</p>
) : null}
</>
) : payable.length > 1 ? (
<Link to="/student/payments" className={primary}>
{t('fee.payMp')}

View File

@@ -4,7 +4,7 @@ import { ExternalLink, Loader2, Receipt } from 'lucide-react'
import { Badge } from '../../components/ui'
import { formatPrice } from '../../lib/format'
import { FeeStatusBadge } from './FeeStatusBadge'
import { feeLabel, formatDueDate } from './format'
import { checkoutItemsLabel, feeLabel, formatDueDate } from './format'
import { useStudentApp } from './StudentAppProvider'
import { useTranslation } from 'react-i18next'
import { useIntlLocale } from '../../i18n'
@@ -57,15 +57,24 @@ export function StudentPaymentsView() {
</div>
</div>
{fee.checkoutUrl && fee.status !== 'reported' ? (
<a
href={fee.checkoutUrl}
target="_blank"
rel="noreferrer"
className="inline-flex min-h-11 items-center gap-1 text-sm font-medium text-accent-fg hover:underline"
>
{t('payments.payMp')}
<ExternalLink className="size-4" aria-hidden="true" />
</a>
<div>
<a
href={fee.checkoutUrl}
target="_blank"
rel="noreferrer"
className="inline-flex min-h-11 items-center gap-1 text-sm font-medium text-accent-fg hover:underline"
>
{fee.checkout
? t('payments.payAll', { amount: formatPrice(fee.checkout.total, fee.currency) })
: t('payments.payMp')}
<ExternalLink className="size-4" aria-hidden="true" />
</a>
{fee.checkout ? (
<p className="text-xs text-secondary">
{t('payments.includes', { items: checkoutItemsLabel(fee.checkout) })}
</p>
) : null}
</div>
) : null}
</li>
))}

View File

@@ -51,11 +51,18 @@ export function dateParts(iso: string, timeZone: string): { day: string; month:
}
}
/** Fee title: its description, or the month it is due ("Noviembre"). */
export function feeLabel(fee: Pick<StudentFee, 'description' | 'dueDate'>): string {
/** Fee title: its description, its month (automatic charges) or the month it is due ("Noviembre"). */
export function feeLabel(fee: Pick<StudentFee, 'description' | 'dueDate'> & { periodKey?: string | null }): string {
if (fee.description) return fee.description
const month = new Intl.DateTimeFormat(i18n.language, { month: 'long', timeZone: 'UTC' }).format(new Date(fee.dueDate))
return month.charAt(0).toUpperCase() + month.slice(1)
const [year, month] = (fee.periodKey ?? '').split('-').map(Number)
const monthDate = year && month ? new Date(Date.UTC(year, month - 1, 15)) : new Date(fee.dueDate)
const monthName = new Intl.DateTimeFormat(i18n.language, { month: 'long', timeZone: 'UTC' }).format(monthDate)
return monthName.charAt(0).toUpperCase() + monthName.slice(1)
}
/** What a combined link pays: "Natación · Juan, Yoga · Ana". */
export function checkoutItemsLabel(checkout: NonNullable<StudentFee['checkout']>): string {
return checkout.items.map((item) => `${item.groupName} · ${firstName(item.studentName)}`).join(', ')
}
export function formatDueDate(iso: string): string {

View File

@@ -106,6 +106,10 @@ export function WhatsappStatusCard() {
<dt className="text-foreground/60">{t('card.reengagement')}</dt>
<dd className="text-primary">{readinessLabel(data.readiness.REENGAGEMENT)}</dd>
</div>
<div className="flex items-center justify-between gap-3">
<dt className="text-foreground/60">{t('card.paymentLink')}</dt>
<dd className="text-primary">{readinessLabel(data.readiness.PAYMENT_LINK)}</dd>
</div>
<p className="pt-1 text-xs text-foreground/50">
{t('card.perGroup')} {weeklySendLabel()}
</p>

View File

@@ -138,7 +138,7 @@ export function formatPairingCode(code: string): string {
*/
export function automationBlockedReason(
status: WhatsappStatusDto | undefined,
kind: 'PAYMENT_REMINDER' | 'REENGAGEMENT',
kind: 'PAYMENT_REMINDER' | 'REENGAGEMENT' | 'PAYMENT_LINK',
): string | null {
if (!status || status.status !== 'active') {
return i18n.t('whatsapp:blocked.notLinked')

View File

@@ -75,7 +75,12 @@
"registerPending": "Recording payments will be available once the payment flow is defined.",
"noCharge": "No charge on record",
"upToDate": "Up to date",
"owes": "Owes {{month}}"
"owes": "Owes {{month}}",
"payWithMp": "Pays with Mercado Pago",
"payWithMpHint": "Turn it off if they prefer to transfer: automatic billing creates their fee without a link.",
"payWithMpOn": "We will create Mercado Pago links for them",
"payWithMpOff": "They will pay by transfer",
"payWithMpError": "We could not save the change"
},
"attendance": {
"title": "Attendance",

View File

@@ -25,7 +25,9 @@
"copied": "Copied",
"copyLink": "Copy link",
"noLink": "No link",
"generate": "Create link"
"generate": "Create link",
"combined_one": "Combined link · {{count}} fee",
"combined_other": "Combined link · {{count}} fees"
},
"groupFilter": {
"label": "Group: {{name}}",

View File

@@ -35,5 +35,37 @@
"callback": {
"mpLinked": "Your Mercado Pago account is linked.",
"whatsappLinked": "Your WhatsApp is linked."
},
"autoCharge": {
"title": "Automatic billing",
"description": "Every month it creates the fees of your monthly groups, with one Mercado Pago link per family.",
"needsMp": "Link Mercado Pago to use it.",
"day": "Day of the month",
"dayOption": "Day {{day}}",
"due": "Due",
"dueOption_one": "In {{count}} day",
"dueOption_other": "In {{count}} days",
"whatsapp": "Send the links by WhatsApp",
"whatsappDescription": "Everyone gets their link as soon as it is created.",
"howItGroups": "Kids of the same adult, and anyone in several groups, get a single link with the total. Students who pay by transfer get their fee without a link.",
"next": "Next run: {{date}}",
"lastRun": "Last billing ({{period}}):",
"running": "in progress.",
"fees_one": "{{count}} fee",
"fees_other": "{{count}} fees",
"links_one": "{{count}} link",
"links_other": "{{count}} links",
"failed_one": "{{count}} link not created",
"failed_other": "{{count}} links not created",
"sent_one": "{{count}} sent by WhatsApp",
"sent_other": "{{count}} sent by WhatsApp",
"skipped": {
"mp_not_connected": "not created because Mercado Pago was not linked.",
"plan_feature_required": "not created because your plan does not include Mercado Pago charges.",
"no_groups": "there were no monthly groups with a price.",
"other": "not created."
},
"saved": "Automatic billing updated",
"saveError": "We could not save automatic billing"
}
}

View File

@@ -51,7 +51,9 @@
"overdue": "Some are overdue",
"payMp": "Pay with Mercado Pago",
"report": "Report payment",
"awaiting": "Your teacher needs to confirm the payment you reported."
"awaiting": "Your teacher needs to confirm the payment you reported.",
"payAll": "Pay all ({{amount}})",
"includes": "Includes: {{items}}"
},
"review": {
"confirmed": "Your teacher confirmed your {{amount}} payment.",
@@ -84,7 +86,9 @@
"reported": "Reported",
"confirmed": "Confirmed",
"rejected": "Declined"
}
},
"payAll": "Pay all ({{amount}})",
"includes": "Includes: {{items}}"
},
"notify": {
"done": "Done, we let {{teacher}} know",

View File

@@ -50,7 +50,10 @@
"invalid": "Invalid time zone"
},
"payment": {
"descriptionMax": "The description is too long"
"descriptionMax": "The description is too long",
"chargeDayRange": "Choose a day between 1 and 28",
"dueInDaysRange": "Choose between 1 and 31 days",
"autoChargeRequired": "There is nothing to change"
},
"lastName": {
"required": "Last name is required"

View File

@@ -75,6 +75,7 @@
"qrHint": "Link it with your number or a QR code, like WhatsApp Web.",
"metaHint": "We'll take you to Meta to connect your WhatsApp Business account.",
"opening": "Opening…",
"connect": "Link"
"connect": "Link",
"paymentLink": "Monthly payment link"
}
}

View File

@@ -75,7 +75,12 @@
"registerPending": "Registrar pagos estará disponible cuando se defina el flujo de cobros.",
"noCharge": "Sin cobro registrado",
"upToDate": "Al día",
"owes": "Debe {{month}}"
"owes": "Debe {{month}}",
"payWithMp": "Paga con Mercado Pago",
"payWithMpHint": "Apágalo si prefiere transferir: el cobro automático le crea la cuota sin link.",
"payWithMpOn": "Le vamos a generar links de Mercado Pago",
"payWithMpOff": "Va a pagar por transferencia",
"payWithMpError": "No pudimos guardar el cambio"
},
"attendance": {
"title": "Asistencia",

View File

@@ -25,7 +25,9 @@
"copied": "Copiado",
"copyLink": "Copiar link",
"noLink": "Sin link",
"generate": "Generar link"
"generate": "Generar link",
"combined_one": "Link combinado · {{count}} cuota",
"combined_other": "Link combinado · {{count}} cuotas"
},
"groupFilter": {
"label": "Grupo: {{name}}",

View File

@@ -35,5 +35,37 @@
"callback": {
"mpLinked": "Tu cuenta de Mercado Pago quedó vinculada.",
"whatsappLinked": "Tu WhatsApp quedó vinculado."
},
"autoCharge": {
"title": "Cobro automático",
"description": "Cada mes genera las cuotas de tus grupos mensuales con un link de Mercado Pago por familia.",
"needsMp": "Vincula Mercado Pago para usarlo.",
"day": "Día del mes",
"dayOption": "Día {{day}}",
"due": "Vencimiento",
"dueOption_one": "A {{count}} día",
"dueOption_other": "A {{count}} días",
"whatsapp": "Enviar los links por WhatsApp",
"whatsappDescription": "Cada uno recibe su link apenas se genera.",
"howItGroups": "Los niños de un mismo adulto, y quien está en varios grupos, reciben un solo link con el total. Los alumnos que pagan por transferencia tienen su cuota sin link.",
"next": "Próxima generación: {{date}}",
"lastRun": "Último cobro ({{period}}):",
"running": "en curso.",
"fees_one": "{{count}} cuota",
"fees_other": "{{count}} cuotas",
"links_one": "{{count}} link",
"links_other": "{{count}} links",
"failed_one": "{{count}} link sin generar",
"failed_other": "{{count}} links sin generar",
"sent_one": "{{count}} enviado por WhatsApp",
"sent_other": "{{count}} enviados por WhatsApp",
"skipped": {
"mp_not_connected": "no se generó porque Mercado Pago no estaba vinculado.",
"plan_feature_required": "no se generó porque tu plan no incluye cobros con Mercado Pago.",
"no_groups": "no había grupos mensuales con precio.",
"other": "no se generó."
},
"saved": "Cobro automático actualizado",
"saveError": "No pudimos guardar el cobro automático"
}
}

View File

@@ -51,7 +51,9 @@
"overdue": "Hay vencidas",
"payMp": "Pagar con Mercado Pago",
"report": "Informar pago",
"awaiting": "Tu profe tiene que confirmar el pago que informaste."
"awaiting": "Tu profe tiene que confirmar el pago que informaste.",
"payAll": "Pagar todo ({{amount}})",
"includes": "Incluye: {{items}}"
},
"review": {
"confirmed": "Tu profe confirmó tu pago de {{amount}}.",
@@ -84,7 +86,9 @@
"reported": "Informado",
"confirmed": "Confirmado",
"rejected": "Rechazado"
}
},
"payAll": "Pagar todo ({{amount}})",
"includes": "Incluye: {{items}}"
},
"notify": {
"done": "Listo, le avisamos a {{teacher}}",

View File

@@ -50,7 +50,10 @@
"invalid": "Zona horaria inválida"
},
"payment": {
"descriptionMax": "La descripción es demasiado larga"
"descriptionMax": "La descripción es demasiado larga",
"chargeDayRange": "Elige un día entre el 1 y el 28",
"dueInDaysRange": "Elige entre 1 y 31 días",
"autoChargeRequired": "No hay nada para cambiar"
},
"lastName": {
"required": "El apellido es obligatorio"

View File

@@ -75,6 +75,7 @@
"qrHint": "Lo vinculas con tu número o con un código QR, como WhatsApp Web.",
"metaHint": "Te llevamos a Meta para conectar tu cuenta de WhatsApp Business.",
"opening": "Abriendo…",
"connect": "Vincular"
"connect": "Vincular",
"paymentLink": "Link de pago mensual"
}
}

View File

@@ -75,7 +75,12 @@
"registerPending": "Registrar pagos estará disponible cuando se defina el flujo de cobros.",
"noCharge": "Sin cobro registrado",
"upToDate": "Al día",
"owes": "Debe {{month}}"
"owes": "Debe {{month}}",
"payWithMp": "Paga con Mercado Pago",
"payWithMpHint": "Apagalo si prefiere transferir: el cobro automático le crea la cuota sin link.",
"payWithMpOn": "Le vamos a generar links de Mercado Pago",
"payWithMpOff": "Va a pagar por transferencia",
"payWithMpError": "No pudimos guardar el cambio"
},
"attendance": {
"title": "Asistencia",

View File

@@ -25,7 +25,9 @@
"copied": "Copiado",
"copyLink": "Copiar link",
"noLink": "Sin link",
"generate": "Generar link"
"generate": "Generar link",
"combined_one": "Link combinado · {{count}} cuota",
"combined_other": "Link combinado · {{count}} cuotas"
},
"groupFilter": {
"label": "Grupo: {{name}}",

View File

@@ -35,5 +35,37 @@
"callback": {
"mpLinked": "Tu cuenta de Mercado Pago quedó vinculada.",
"whatsappLinked": "Tu WhatsApp quedó vinculado."
},
"autoCharge": {
"title": "Cobro automático",
"description": "Cada mes genera las cuotas de tus grupos mensuales con un link de Mercado Pago por familia.",
"needsMp": "Vinculá Mercado Pago para usarlo.",
"day": "Día del mes",
"dayOption": "Día {{day}}",
"due": "Vencimiento",
"dueOption_one": "A {{count}} día",
"dueOption_other": "A {{count}} días",
"whatsapp": "Enviar los links por WhatsApp",
"whatsappDescription": "Cada uno recibe su link apenas se genera.",
"howItGroups": "Los chicos de un mismo adulto, y quien está en varios grupos, reciben un solo link con el total. Los alumnos que pagan por transferencia tienen su cuota sin link.",
"next": "Próxima generación: {{date}}",
"lastRun": "Último cobro ({{period}}):",
"running": "en curso.",
"fees_one": "{{count}} cuota",
"fees_other": "{{count}} cuotas",
"links_one": "{{count}} link",
"links_other": "{{count}} links",
"failed_one": "{{count}} link sin generar",
"failed_other": "{{count}} links sin generar",
"sent_one": "{{count}} enviado por WhatsApp",
"sent_other": "{{count}} enviados por WhatsApp",
"skipped": {
"mp_not_connected": "no se generó porque Mercado Pago no estaba vinculado.",
"plan_feature_required": "no se generó porque tu plan no incluye cobros con Mercado Pago.",
"no_groups": "no había grupos mensuales con precio.",
"other": "no se generó."
},
"saved": "Cobro automático actualizado",
"saveError": "No pudimos guardar el cobro automático"
}
}

View File

@@ -51,7 +51,9 @@
"overdue": "Hay vencidas",
"payMp": "Pagar con Mercado Pago",
"report": "Informar pago",
"awaiting": "Tu profe tiene que confirmar el pago que informaste."
"awaiting": "Tu profe tiene que confirmar el pago que informaste.",
"payAll": "Pagar todo ({{amount}})",
"includes": "Incluye: {{items}}"
},
"review": {
"confirmed": "Tu profe confirmó tu pago de {{amount}}.",
@@ -84,7 +86,9 @@
"reported": "Informado",
"confirmed": "Confirmado",
"rejected": "Rechazado"
}
},
"payAll": "Pagar todo ({{amount}})",
"includes": "Incluye: {{items}}"
},
"notify": {
"done": "Listo, le avisamos a {{teacher}}",

View File

@@ -50,7 +50,10 @@
"invalid": "Zona horaria inválida"
},
"payment": {
"descriptionMax": "La descripción es demasiado larga"
"descriptionMax": "La descripción es demasiado larga",
"chargeDayRange": "Elegí un día entre el 1 y el 28",
"dueInDaysRange": "Elegí entre 1 y 31 días",
"autoChargeRequired": "No hay nada para cambiar"
},
"lastName": {
"required": "El apellido es obligatorio"

View File

@@ -75,6 +75,7 @@
"qrHint": "Lo vinculás con tu número o con un código QR, como WhatsApp Web.",
"metaHint": "Te llevamos a Meta para conectar tu cuenta de WhatsApp Business.",
"opening": "Abriendo…",
"connect": "Vincular"
"connect": "Vincular",
"paymentLink": "Link de pago mensual"
}
}

View File

@@ -75,7 +75,12 @@
"registerPending": "Registrar pagamentos estará disponível quando o fluxo de cobranças for definido.",
"noCharge": "Nenhuma cobrança registrada",
"upToDate": "Em dia",
"owes": "Deve {{month}}"
"owes": "Deve {{month}}",
"payWithMp": "Paga com Mercado Pago",
"payWithMpHint": "Desative se preferir transferência: a cobrança automática cria a mensalidade sem link.",
"payWithMpOn": "Vamos gerar links do Mercado Pago",
"payWithMpOff": "Vai pagar por transferência",
"payWithMpError": "Não foi possível salvar a alteração"
},
"attendance": {
"title": "Presença",

View File

@@ -25,7 +25,9 @@
"copied": "Copiado",
"copyLink": "Copiar link",
"noLink": "Sem link",
"generate": "Gerar link"
"generate": "Gerar link",
"combined_one": "Link combinado · {{count}} mensalidade",
"combined_other": "Link combinado · {{count}} mensalidades"
},
"groupFilter": {
"label": "Grupo: {{name}}",

View File

@@ -35,5 +35,37 @@
"callback": {
"mpLinked": "Sua conta do Mercado Pago foi vinculada.",
"whatsappLinked": "Seu WhatsApp foi vinculado."
},
"autoCharge": {
"title": "Cobrança automática",
"description": "Todo mês gera as mensalidades dos seus grupos mensais com um link do Mercado Pago por família.",
"needsMp": "Vincule o Mercado Pago para usar.",
"day": "Dia do mês",
"dayOption": "Dia {{day}}",
"due": "Vencimento",
"dueOption_one": "Em {{count}} dia",
"dueOption_other": "Em {{count}} dias",
"whatsapp": "Enviar os links pelo WhatsApp",
"whatsappDescription": "Cada um recebe seu link assim que ele é gerado.",
"howItGroups": "As crianças de um mesmo adulto, e quem está em vários grupos, recebem um único link com o total. Alunos que pagam por transferência ficam com a mensalidade sem link.",
"next": "Próxima geração: {{date}}",
"lastRun": "Última cobrança ({{period}}):",
"running": "em andamento.",
"fees_one": "{{count}} mensalidade",
"fees_other": "{{count}} mensalidades",
"links_one": "{{count}} link",
"links_other": "{{count}} links",
"failed_one": "{{count}} link não gerado",
"failed_other": "{{count}} links não gerados",
"sent_one": "{{count}} enviado pelo WhatsApp",
"sent_other": "{{count}} enviados pelo WhatsApp",
"skipped": {
"mp_not_connected": "não foi gerada porque o Mercado Pago não estava vinculado.",
"plan_feature_required": "não foi gerada porque seu plano não inclui cobranças com Mercado Pago.",
"no_groups": "não havia grupos mensais com preço.",
"other": "não foi gerada."
},
"saved": "Cobrança automática atualizada",
"saveError": "Não foi possível salvar a cobrança automática"
}
}

View File

@@ -51,7 +51,9 @@
"overdue": "Há vencidas",
"payMp": "Pagar com Mercado Pago",
"report": "Informar pagamento",
"awaiting": "Seu professor precisa confirmar o pagamento que você informou."
"awaiting": "Seu professor precisa confirmar o pagamento que você informou.",
"payAll": "Pagar tudo ({{amount}})",
"includes": "Inclui: {{items}}"
},
"review": {
"confirmed": "Seu professor confirmou seu pagamento de {{amount}}.",
@@ -84,7 +86,9 @@
"reported": "Informado",
"confirmed": "Confirmado",
"rejected": "Recusado"
}
},
"payAll": "Pagar tudo ({{amount}})",
"includes": "Inclui: {{items}}"
},
"notify": {
"done": "Pronto, avisamos {{teacher}}",

View File

@@ -50,7 +50,10 @@
"invalid": "Fuso horário inválido"
},
"payment": {
"descriptionMax": "A descrição é muito longa"
"descriptionMax": "A descrição é muito longa",
"chargeDayRange": "Escolha um dia entre 1 e 28",
"dueInDaysRange": "Escolha entre 1 e 31 dias",
"autoChargeRequired": "Não há nada para alterar"
},
"lastName": {
"required": "O sobrenome é obrigatório"

View File

@@ -75,6 +75,7 @@
"qrHint": "Você vincula com seu número ou com um QR code, como no WhatsApp Web.",
"metaHint": "Vamos te levar à Meta para conectar sua conta do WhatsApp Business.",
"opening": "Abrindo…",
"connect": "Vincular"
"connect": "Vincular",
"paymentLink": "Link de pagamento mensal"
}
}

View File

@@ -78,6 +78,8 @@ import type {
ReportedPaymentDto,
ReceiptUrlDto,
TransferDetailsDto,
AutoChargeSettingsDto,
UpdateAutoChargeSettings,
UpdateTransferDetails,
TeacherAbsenceNoticeList,
PersonSummary,
@@ -621,6 +623,14 @@ export const rejectReportedPayment = (reportId: string, reason: string | null) =
export const undoPaymentReview = (reportId: string) =>
apiFetch<ReportedPaymentDto>(`/api/v1/payments/reported/${reportId}/undo`, { method: 'POST' })
export const getAutoChargeSettings = () => apiFetch<AutoChargeSettingsDto>('/api/v1/payments/auto-charge')
export const updateAutoChargeSettings = (payload: UpdateAutoChargeSettings) =>
apiFetch<AutoChargeSettingsDto>('/api/v1/payments/auto-charge', {
method: 'PUT',
body: JSON.stringify(payload),
})
export const getTransferDetails = () => apiFetch<TransferDetailsDto>('/api/v1/payments/transfer-details')
export const updateTransferDetails = (payload: UpdateTransferDetails) =>