feat(student-app): aluno paga a propria fatura pelo app (checkout Stripe)#154
Merged
Conversation
…ipe) P3: botao "Pagar" nas cobrancas em aberto do Perfil inicia um checkout Stripe da PROPRIA fatura. Roda no schema do box ativo -> a baixa segue pelo webhook ja existente (router._handle_student_payment + confirmacao do #150). - integrations.stripe.create_checkout_session: aceita success_url/cancel_url opcionais (default = rotas do staff, retrocompat) e trata ator anonimo (o aluno nao e request.user do Django). - student_app.student_payments_presentation.resolve_payable_student_invoice: seguranca — so a fatura DO PROPRIO aluno e EM ABERTO e pagavel. As rows ganham id + is_open. - student_app/views/payment_views.py: StudentPayInvoiceView (rate-limit anti card-testing + checagem de posse, redireciona pro Stripe) + paginas de retorno StudentPaySuccessView/StudentPayCancelView no /aluno/. - urls + templates pay_success/pay_cancel + botao "Pagar" no settings.html. - Testes: posse/estado da fatura (proprio/outro/paga/inexistente), rows id/is_open, e create_checkout_session com URLs do aluno + ator anonimo. Visual segue o shell do app (revisar no /aluno/). Logica verificada no CI. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fecha o P3 (self-service): o aluno paga a própria fatura pelo app. Botão "Pagar" nas cobranças em aberto do Perfil → checkout Stripe → a baixa segue pelo webhook já existente (#140) + a confirmação (#150).
O que entra
create_checkout_sessionganhasuccess_url/cancel_urlopcionais (default = rotas do staff, retrocompat) e trata ator anônimo (o aluno não érequest.userdo Django — auth por cookie próprio). Roda no schema do box ativo, então obox_schemaentra na metadata e a reconciliação funciona.resolve_payable_student_invoice(segurança): só a fatura do próprio aluno e em aberto (pendente/atrasada) é pagável — qualquer outra (de outro aluno, paga, cancelada, inexistente) é negada.StudentPayInvoiceView: rate-limit anti card-testing (reusacheckout_rate_limit_exceeded) + checagem de posse → redireciona pro Stripe. Páginas de retornoStudentPaySuccessView/StudentPayCancelViewno/aluno/.pay_success/pay_cancel(no shell do app) + botão "Pagar" nas linhas de Pagamentos do Perfil (só nas em aberto).Testes
tests/test_student_payment_flow.py: posse/estado da fatura (próprio/outro/paga/inexistente), rows comid/is_open, ecreate_checkout_sessioncom URLs do aluno + ator anônimo. Lógica verificada no CI.Revisar
O visual segue o shell do app (reusei
student-card/student-primary-action), mas não verifico headless — dá uma olhada no/aluno/configuracoes/(botão Pagar) e nas telas de retorno quando puder.🤖 Generated with Claude Code