Feature: Get boleto info#243
Conversation
|
Nice job @lucascarrias ! @all-contributors please add @lucascarrias for docs, tests, and code. |
|
I've put up a pull request to add @lucascarrias! 🎉 |
|
@hyanmandian Thanks for the reviews! I'll follow your recommendations. |
* Create BANCO_CENTRAL_BASE_DATE constant * Create variables to helper values * Replace .substr() by .slice() method
|
@hyanmandian I've refactored the code following the changes requests, with some notes:
|
|
As soon I have time I will merge and publish your utility. Thanks for your contribution and welcome aboard! |
| } | ||
|
|
||
| export function getBankCode(digitableLine: string): string { | ||
| if (!digitableLine || !isValid(digitableLine)) return ''; |
There was a problem hiding this comment.
Is this a valid case? (return an empty string here)
| const daysSinceBaseDayEndIndex = -10; | ||
| const daysSinceBaseDay = digitableLine.slice(daysSinceBaseDayStartIndex, daysSinceBaseDayEndIndex); | ||
|
|
||
| const oneDayMilliseconds = 24 * 60 * 60 * 1000; |
There was a problem hiding this comment.
This can be moved outside of the function so it can be evaluated on parsing.
|
Fala @lucascarrias tudo certo? Cara, to fazendo um refactoring ta lib inteira e vou incluir sua alteracao la! #398 @diasbruno pode ficar tranquilo que incluirei sua sugestao de melhoria tb! Sintam-se a vontade a fazer o review se quiserem! |
References
[Feature request] Get "boleto" information from digitable line #239
Objectives
Create getBoletoInfo function to get data from a valid boleto.
Usage example:
Changes
Notes
The
currencyfield mentioned at #239 hasn't been added because, most of cases, the brazilian payment method will be charged with BRL values.