-
Notifications
You must be signed in to change notification settings - Fork 16
fix: add new enums and types for Pix payload structure #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis update introduces several new enums and types to model periodicity, retry policies, status codes, agent modalities, debtor entities, and withdrawal details. It refactors existing payload types to use these new definitions, renames some fields, adds optional fields, updates type annotations, and removes a previously exported example constant. Changes
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. ✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/types/pixDynamicPayload.ts
(5 hunks)
🔇 Additional comments (10)
src/types/pixDynamicPayload.ts (10)
8-14
: Well-structured enum for payment periodicityThe
Periodicidade
enum is clearly defined with appropriate string values that match the Brazilian PIX standard nomenclature for recurring payment periods. This provides good type safety and self-documentation.
16-19
: Properly defined retry policy enumThe
PoliticaRetentativa
enum correctly represents the retry policy options available in the PIX system, with clear and descriptive values that follow the official specification.
21-27
: Comprehensive status enum for recurring paymentsThe
StatusRec
enum covers all the necessary states for recurring PIX payments, providing better type safety than string literals.
29-38
: Well-defined agent modality enumsBoth
ModalidadeAgente
andModalidadeAgenteTroco
enums follow the PIX specification for agent types. Note thatModalidadeAgenteTroco
has fewer options thanModalidadeAgente
(missingAGPSS
), which correctly reflects the PIX specification for change agents.
50-60
: Good type abstraction for debtor entitiesCreating dedicated types for
DevedorPF
(individual) andDevedorPJ
(company) and unifying them with theDevedor
union type improves code organization and reusability. This approach eliminates duplication and ensures consistent structure across the codebase.
62-79
: Well-structured withdrawal typesThe
RetiradaSaque
,RetiradaTroco
, and combinedRetirada
types properly model the withdrawal functionality according to PIX specifications. The optional properties and nested structure provide flexibility while maintaining type safety.
89-89
: Good improvements to PIXFuturePayloadReplacing the inline debtor definition with the reusable
Devedor
type and adding the optionalnomeFantasia
field enhances both code maintainability and functionality.Also applies to: 94-94
122-122
: Enhanced PIXInstantPayload with withdrawal supportUsing the
Devedor
type and adding theretirada
field properly implements the withdrawal functionality for instant payments as described in the PR objectives.Also applies to: 126-126
139-146
: Improved PIXRecPayload calendar and debtor fieldsThe changes correctly use the new
Devedor
type and add support for an optional end date (dataFinal
) in the calendar. Using the enumPeriodicidade
instead of string literals improves type safety.
156-159
: Improved type safety for policy and status fieldsUsing the newly defined enums
PoliticaRetentativa
andStatusRec
for the respective fields improves type safety and provides better developer experience through autocompletion and documentation.
## [2.7.1](v2.7.0...v2.7.1) (2025-05-23) ### Bug Fixes * add new enums and types for Pix payload structure ([#34](#34)) ([081e586](081e586))
🎉 This issue has been resolved in version 2.7.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What kind of change does this PR introduce?
Feature - Enhanced PIX payload type definitions and added new enums
What is the current behavior?
The current implementation has basic type definitions for PIX payloads with some string-based enums and less structured types.
What is the new behavior (if this is a feature change)?
Added comprehensive type definitions and enums for PIX payload structure:
New enums for better type safety:
Periodicidade
(SEMANAL, MENSAL, TRIMESTRAL, SEMESTRAL, ANUAL)PoliticaRetentativa
(NAO_PERMITE, PERMITE_3R_7D)StatusRec
(CRIADA, APROVADA, REJEITADA, EXPIRADA, CANCELADA)ModalidadeAgente
(AGTEC, AGTOT, AGPSS)ModalidadeAgenteTroco
(AGTEC, AGTOT)Enhanced type definitions:
DevedorPF
andDevedorPJ
types with union typeDevedor
RetiradaSaque
andRetiradaTroco
types with union typeRetirada
Other information:
This change improves type safety and provides better documentation through TypeScript's type system. The changes are backward compatible as they only enhance the type definitions without changing the runtime behavior.