Feature: Get boleto info
References
[Feature request] Get "boleto" information from digitable line #239
Objectives
Create getBoletoInfo function to get data from a valid boleto.
Usage example:
>> getBoletoInfo('23793381286006069409261000063307486470000004200');
>> {
valueInCents: 4200,
expirationDate: 2021-06-10T03:00:00.000Z,
bankCode: '237'
}
Changes
- Create getValueInCents function
- Create getExpirationDate function
- Create getBankCode function
- Create Boleto interface
- Create getInfo function and export it as getBoletoInfo
- Add getBoletoInfo to docs
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.
Nice job @LucasCarrias ! @all-contributors please add @LucasCarrias for docs, tests, and code.
@hyanmandian Thanks for the reviews! I'll follow your recommendations.
@hyanmandian I've refactored the code following the changes requests, with some notes:
- The
substrmethod was replaced bysliceas the substr is considered a legacy method (ref) - Negatives indexes were used instead of using the
someString.length - reverveIndexPositionexpression
As soon I have time I will merge and publish your utility.
Thanks for your contribution and welcome aboard!