├── .eslintrc.json ├── .gitignore ├── .prettierrc ├── LICENSE ├── README.md ├── index.js ├── lib ├── helper.js └── parser.js ├── package.json └── yarn.lock /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["airbnb", "prettier"], 3 | "plugins": ["prettier"], 4 | "rules": { 5 | "prettier/prettier": ["error"] 6 | } 7 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 100, 3 | "singleQuote": true 4 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Achmad Apriady 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nodejs-bca-scraper 2 | 3 | Plugin untuk membantu anda mendapatkan informasi saldo terakhir rekening BCA anda serta mutasi rekening BCA anda pada hari itu melalui KlikBCA. 4 | 5 | ## Cara Install 6 | 7 | ```bash 8 | npm install --save nodejs-bca-scraper 9 | ``` 10 | 11 | atau 12 | 13 | ```bash 14 | yarn add nodejs-bca-scraper 15 | ``` 16 | 17 | ## Penggunaan 18 | 19 | ```javascript 20 | const bca = require('nodejs-bca-scraper'); 21 | ``` 22 | 23 | ### Cek Saldo Terakhir 24 | 25 | ```javascript 26 | bca 27 | .getBalance(USERNAME, PASSWORD) 28 | .then(res => { 29 | console.log('saldo ', res); 30 | }) 31 | .catch(err => { 32 | console.log('error ', err); 33 | }); 34 | ``` 35 | 36 | ### Cek Settlement Pada Hari Itu 37 | 38 | ```javascript 39 | bca 40 | .getSettlement(USERNAME, PASSWORD) 41 | .then(res => { 42 | console.log('settlement ', res); 43 | }) 44 | .catch(err => { 45 | console.log('error ', err); 46 | }); 47 | ``` 48 | 49 | # License 50 | 51 | MIT 52 | 53 | # Author 54 | 55 | [Achmad Apriady](mailto:achmad.apriady@gmail.com) 56 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const parser = require('./lib/parser'); 2 | 3 | module.exports = { 4 | getBalance: async (username, password) => { 5 | try { 6 | const IP = await parser.getIP(); 7 | await parser.login(username, password, IP); 8 | await parser.openSettlementMenu(); 9 | const balance = await parser.balance(); 10 | await parser.logout(); 11 | return balance; 12 | } catch (err) { 13 | await parser.logout(); 14 | throw err; 15 | } 16 | }, 17 | 18 | getSettlement: async (username, password) => { 19 | try { 20 | const IP = await parser.getIP(); 21 | await parser.login(username, password, IP); 22 | await parser.openSettlementMenu(); 23 | const settlement = await parser.settlement(); 24 | await parser.logout(); 25 | return settlement; 26 | } catch (err) { 27 | await parser.logout(); 28 | throw err; 29 | } 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /lib/helper.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | stringBetween: (input, start, end) => { 3 | return input.match(new RegExp(`${start}([\\S\\s]*?)${end}`))[1]; 4 | }, 5 | tdValue: input => { 6 | return input.match(/