Skip to content

Add CNPJ alphanumeric#41

Open
pedrofirmiano-stark wants to merge 1 commit into
feature/bradescofrom
feature/cnpj-alphanumeric
Open

Add CNPJ alphanumeric#41
pedrofirmiano-stark wants to merge 1 commit into
feature/bradescofrom
feature/cnpj-alphanumeric

Conversation

@pedrofirmiano-stark

Copy link
Copy Markdown

No description provided.

@pedrofirmiano-stark pedrofirmiano-stark changed the base branch from master to feature/bradesco July 6, 2026 22:28
Comment thread febraban/cnab240/row.py
charactersType=type,
numberOfCharacters=len,
defaultCharacter={numeric: "0", alphaNumeric: " "}[type]
defaultCharacter={numeric: "0", alphaNumeric: " ", alphaNumericRightAligned: "0"}[type]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

para alfanumerico é para completar com espaço e não com zero. Zero é usado somente para o numerico

structs = [
(17, 18, 1, numeric, "1" if len(user.identifier) == 11 else "2"), # 1 - CPF/ 2 - CNPJ
(18, 33, 15, numeric, user.identifier), # CPF/CNPJ do Pagador
(18, 33, 15, alphaNumericRightAligned, user.identifier), # CPF/CNPJ do Pagador

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comentario desalinhado

structs = [
(153, 154, 1, numeric, "1" if len(user.identifier) == 11 else "2"), # 1 - CPF/ 2 - CNPJ
(154, 169, 15, numeric, user.identifier), # CPF/CNPJ do Sacador Avalista
(154, 169, 15, alphaNumericRightAligned, user.identifier), # CPF/CNPJ do Sacador Avalista

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alinhar o comentario

Comment thread febraban/cnab240/row.py
"""
if type(string) != str: return defaultCharacter * numberOfCharacters
if len(string) > numberOfCharacters: return string[:numberOfCharacters]
if charactersType == numeric: return defaultCharacter * (numberOfCharacters - len(string)) + string

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

porque foi removido essa condicional ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants