Commit 60289367aeb13034bbac106340f38dfebbdf3ce0
1 parent
8a677923a6
Exists in
master
Perbaikan extractSnFromMessage agar bisa parsing hasil topUpInquiry
Showing 2 changed files with 6 additions and 2 deletions Side-by-side Diff
lib/st24.js
... | ... | @@ -31,7 +31,7 @@ function extractFromMessage(msg, default_pattern, default_match_idx, custom_rule |
31 | 31 | } |
32 | 32 | |
33 | 33 | function extractSnFromMessage(msg, custom_rule) { |
34 | - const default_pattern = "^SN=(.*?);"; | |
34 | + const default_pattern = "SN=(.*?);"; | |
35 | 35 | const default_match_idx = 1; |
36 | 36 | |
37 | 37 | return extractFromMessage(msg, default_pattern, default_match_idx, custom_rule); |
test.js
... | ... | @@ -9,9 +9,13 @@ describe('#st24', function() { |
9 | 9 | describe('#extractSnFromMessage', function() { |
10 | 10 | |
11 | 11 | describe('#using default st24 rule', function() { |
12 | - it('should return correct sn', function() { | |
12 | + it('should return correct sn from topUpRequest response', function() { | |
13 | 13 | st24.extractSnFromMessage('SN=0419165234155980102;19/04/18 16:52 ISI TR5 KE 0895621829255, SUKSES.SAL=1.323.934,HRG=5.250,ID=46398092,SN=0419165234155980102; ..trx lancar').should.equal('0419165234155980102'); |
14 | 14 | }) |
15 | + | |
16 | + it('should return correct sn from topUpInquiry response', function() { | |
17 | + st24.extractSnFromMessage('19/07/18 20:53 ISI SPT20 KE 081264858057, SUKSES.SAL=828.425,HRG=19.700,ID=48761021,SN=0041002635369521;').should.equal('0041002635369521'); | |
18 | + }) | |
15 | 19 | }) |
16 | 20 | |
17 | 21 | describe('#using custom rule', function() { |