Commit 043c7829876cf0befb8b947e1b4a7fe7838ac4f6

Authored by Adhidarma Hadiwinoto
1 parent dbacc12f55
Exists in master

strftime

Showing 2 changed files with 14 additions and 1 deletions Side-by-side Diff

... ... @@ -24,6 +24,7 @@
24 24 "request": "~2.60.0",
25 25 "mathjs": "~1.7.1",
26 26 "xml": "~1.0.0",
27   - "xml2js": "~0.4.9"
  27 + "xml2js": "~0.4.9",
  28 + "strftime": "~0.9.2"
28 29 }
29 30 }
... ... @@ -255,6 +255,17 @@ function balanceCheck() {
255 255  
256 256 }
257 257  
  258 +function balanceFromMessage(message) {
  259 + matches = message.match(/Saldo: Rp (\d+)/);
  260 + if (!matches) {
  261 + return null;
  262 + }
  263 +
  264 + if (matches.length <= 1) {
  265 + return null;
  266 + }
  267 + return matches[0];
  268 +}
258 269  
259 270 function start(_config, _callbackReport) {
260 271 config = _config;
... ... @@ -265,3 +276,4 @@ function start(_config, _callbackReport) {
265 276  
266 277 exports.start = start;
267 278 exports.topupRequest = topupRequest;
  279 +exports.balanceFromMessage = balanceFromMessage;