How staroscky/pagamento-fatura-bff-poc works
This is a payment-invoice BFF whose documented focus is starting a payment journey. The request handler delegates to a service that obtains card details, concurrently fetches invoice and balance data, creates a journey context in Redis, and maps the result. Invoice status interpretation and the journey’s separated response-mapping concerns are also represented. The sampled code supports these main calls; several APIs and mapper details are present only in the tree or README, so uncertain wiring is omitted.
Main entry points: IniciacaoService.kt Initiation service · FaturaService.kt Invoice service · IniciacaoController.kt Initiation endpoint · JornadaRepository.kt Journey repository
Components 23
Journey initiation
- Initiation endpoint
src/main/kotlin/com/staroscky/pagamentofatura/jornada/iniciacao/controller/IniciacaoController.kt - Initiation service
src/main/kotlin/com/staroscky/pagamentofatura/jornada/iniciacao/service/IniciacaoService.kt - Journey context
src/main/kotlin/com/staroscky/pagamentofatura/jornada/core/domain/JornadaContext.kt - Journey repository
src/main/kotlin/com/staroscky/pagamentofatura/jornada/core/cache/JornadaRepository.kt - Redis cache
- Response mapper
src/main/kotlin/com/staroscky/pagamentofatura/jornada/iniciacao/mapper/IniciacaoMapper.kt - Amount suggestions
src/main/kotlin/com/staroscky/pagamentofatura/jornada/iniciacao/mapper/SugestaoValorMapper.kt - Invoice mapping
src/main/kotlin/com/staroscky/pagamentofatura/jornada/iniciacao/mapper/InformacoesFaturaMapper.kt - Auto-debit mapping
src/main/kotlin/com/staroscky/pagamentofatura/jornada/iniciacao/mapper/AvisoDebitoAutomaticoMapper.kt - Initiation response
src/main/kotlin/com/staroscky/pagamentofatura/jornada/iniciacao/domain/IniciacaoResponse.kt
Payment data
- Card API
src/main/kotlin/com/staroscky/pagamentofatura/cartao/CartaoAPI.kt - Card service
src/main/kotlin/com/staroscky/pagamentofatura/cartao/service/CartaoService.kt - Card details
src/main/kotlin/com/staroscky/pagamentofatura/cartao/domain/CartaoInfo.kt - Invoice API
src/main/kotlin/com/staroscky/pagamentofatura/fatura/FaturaAPI.kt - Invoice service
src/main/kotlin/com/staroscky/pagamentofatura/fatura/service/FaturaService.kt - Invoice details
src/main/kotlin/com/staroscky/pagamentofatura/fatura/domain/FaturaInfo.kt - Invoice status
src/main/kotlin/com/staroscky/pagamentofatura/fatura/helper/StatusHelper.kt - Payment status
src/main/kotlin/com/staroscky/pagamentofatura/fatura/helper/StatusPagamentoHelper.kt - Balance API
src/main/kotlin/com/staroscky/pagamentofatura/saldo/SaldoAPI.kt - Balance service
src/main/kotlin/com/staroscky/pagamentofatura/saldo/service/SaldoService.kt - Balance result
src/main/kotlin/com/staroscky/pagamentofatura/saldo/domain/SaldoResult.kt
Shared context
- User context
src/main/kotlin/com/staroscky/pagamentofatura/core/UsuarioContext.kt
Other components
- Client
Connections 19
- Client → Initiation endpoint: submits request
- Initiation endpoint → Initiation service: starts journey
- Initiation service → Card API: consults card
- Card API → Card service: implemented by
- Card service → Card details: returns details
- Initiation service → Invoice API: fetches invoice
- Invoice API → Invoice service: implemented by
- Invoice service → Invoice status: evaluates status
- Invoice service → Payment status: evaluates payment
- Invoice service → Invoice details: returns details
- Initiation service → Balance API: fetches balance
- Balance API → Balance service: implemented by
- Balance service → Balance result: returns result
- Initiation service → User context: reads user ID
- Initiation service → Journey repository: creates journey
- Initiation service → Journey context: builds context
- Journey repository → Redis cache: stores context
- Initiation service → Response mapper: maps response
- Response mapper → Initiation response: builds response