-
Notifications
You must be signed in to change notification settings - Fork 108
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
Feature: Get boleto info #243
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be moved outside of the function so it can be evaluated on parsing.
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
currency
field mentioned at #239 hasn't been added because, most of cases, the brazilian payment method will be charged with BRL values.