Commit bbcd4a097289a3541e018e03cdaf000d7d76f807
1 parent
b56c660f24
Exists in
master
RC 88 TAGIHAN SUDAH TERBAYAR
Showing 2 changed files with 8 additions and 1 deletions Inline Diff
1 | module.exports = [ | 1 | module.exports = [ |
2 | { | 2 | { |
3 | pattern: " BERHASIL", | 3 | pattern: " BERHASIL", |
4 | rc: '00' | 4 | rc: '00' |
5 | }, | 5 | }, |
6 | { | 6 | { |
7 | pattern: "SUKSES", | 7 | pattern: "SUKSES", |
8 | rc: '00' | 8 | rc: '00' |
9 | }, | 9 | }, |
10 | { | 10 | { |
11 | pattern: " under process", | 11 | pattern: " under process", |
12 | rc: '68' | 12 | rc: '68' |
13 | }, | 13 | }, |
14 | { | 14 | { |
15 | pattern: " under proses", | 15 | pattern: " under proses", |
16 | rc: '68' | 16 | rc: '68' |
17 | }, | 17 | }, |
18 | { | 18 | { |
19 | pattern: " sedang dalam antrian", | 19 | pattern: " sedang dalam antrian", |
20 | rc: '68' | 20 | rc: '68' |
21 | }, | 21 | }, |
22 | { | 22 | { |
23 | pattern: " sdg dalam antrian", | 23 | pattern: " sdg dalam antrian", |
24 | rc: '68' | 24 | rc: '68' |
25 | }, | 25 | }, |
26 | { | 26 | { |
27 | pattern: " sedang diproses", | 27 | pattern: " sedang diproses", |
28 | rc: '68' | 28 | rc: '68' |
29 | }, | 29 | }, |
30 | { | 30 | { |
31 | pattern: " sdg diproses", | 31 | pattern: " sdg diproses", |
32 | rc: '68' | 32 | rc: '68' |
33 | }, | 33 | }, |
34 | { | 34 | { |
35 | pattern: " nomor tujuan dan produk tidak sesuai", | 35 | pattern: " nomor tujuan dan produk tidak sesuai", |
36 | rc: '14', | 36 | rc: '14', |
37 | flags: 'i' | 37 | flags: 'i' |
38 | }, | 38 | }, |
39 | { | 39 | { |
40 | pattern: " tujuan salah", | 40 | pattern: " tujuan salah", |
41 | rc: '14' | 41 | rc: '14' |
42 | }, | 42 | }, |
43 | { | 43 | { |
44 | pattern: "Nomor tidak valid", | 44 | pattern: "Nomor tidak valid", |
45 | rc: '14' | 45 | rc: '14' |
46 | }, | 46 | }, |
47 | { | 47 | { |
48 | pattern: "NOMOR METER YANG ANDA MASUKKAN SALAH", | 48 | pattern: "NOMOR METER YANG ANDA MASUKKAN SALAH", |
49 | rc: '14' | 49 | rc: '14' |
50 | }, | 50 | }, |
51 | { | 51 | { |
52 | pattern: "Maaf Produk sedang gangguan", | 52 | pattern: "Maaf Produk sedang gangguan", |
53 | rc: '90', | 53 | rc: '90', |
54 | flags: 'i' | 54 | flags: 'i' |
55 | }, | 55 | }, |
56 | { | 56 | { |
57 | pattern: "Maaf.*Sedang gangguan. Coba ulangi beberapa saat lagi", | 57 | pattern: "Maaf.*Sedang gangguan. Coba ulangi beberapa saat lagi", |
58 | rc: '90', | 58 | rc: '90', |
59 | flags: 'i' | 59 | flags: 'i' |
60 | }, | 60 | }, |
61 | { | 61 | { |
62 | pattern: " RC:61 ", | 62 | pattern: " RC:61 ", |
63 | rc: '90' | 63 | rc: '90' |
64 | }, | 64 | }, |
65 | { | 65 | { |
66 | pattern: "TAGIHAN SUDAH TERBAYAR", | ||
67 | rc: '88', | ||
68 | }, | ||
69 | { | ||
66 | pattern: "GAGAL", | 70 | pattern: "GAGAL", |
67 | rc: '40' | 71 | rc: '40' |
68 | } | 72 | } |
69 | ] | 73 | ] |
70 | 74 |
test/main.js
1 | /* global describe it */ | 1 | /* global describe it */ |
2 | 2 | ||
3 | //process.env.KOMODO_SDK_DEBUG_RC_FROM_MSG = 'YES'; | 3 | //process.env.KOMODO_SDK_DEBUG_RC_FROM_MSG = 'YES'; |
4 | 4 | ||
5 | const should = require('should'); | 5 | const should = require('should'); |
6 | const irs = require('../index'); | 6 | const irs = require('../index'); |
7 | 7 | ||
8 | describe('#irs', function() { | 8 | describe('#irs', function() { |
9 | describe('#getRcFromMessage', function() { | 9 | describe('#getRcFromMessage', function() { |
10 | it('should return correct rc', function() { | 10 | it('should return correct rc', function() { |
11 | irs.getRcFromMessage('Request IBP25 ke 085736328877 under proses..').should.equal('68'); | 11 | irs.getRcFromMessage('Request IBP25 ke 085736328877 under proses..').should.equal('68'); |
12 | irs.getRcFromMessage('Transaksi HX5 ke 081809903333 GAGAL. Mohon periksa kembali No tujuan sebelum di ulang. Saldo: Rp 26.857.538').should.equal('40'); | 12 | irs.getRcFromMessage('Transaksi HX5 ke 081809903333 GAGAL. Mohon periksa kembali No tujuan sebelum di ulang. Saldo: Rp 26.857.538').should.equal('40'); |
13 | irs.getRcFromMessage('REFF#11538167 Trx IBP25.085736328877 BERHASIL,Harga: 24.475 SN: 503133415264594 Sisa Saldo: 1.169.227 - 24.475 = 1.144.752 @5/3/2018 1:34:13 PM').should.equal('00'); | 13 | irs.getRcFromMessage('REFF#11538167 Trx IBP25.085736328877 BERHASIL,Harga: 24.475 SN: 503133415264594 Sisa Saldo: 1.169.227 - 24.475 = 1.144.752 @5/3/2018 1:34:13 PM').should.equal('00'); |
14 | 14 | ||
15 | irs.getRcFromMessage('REFF#1238 CEK TAGIHAN PLN16 SUKSES IDPEL:538710624871 Detail: NAMA:MUSHOLLA-NURUL-KHOIR/DAYA:450/TARIF:S2/JMLBLN:1BLN/PERIODE:201712/METERKINI:18984/METERLALU:18932/TAGIHAN:14441/ADM:1600/DENDA:3000/TOTALTAGIHAN:19041 Sisa Saldo: 180.318 - 0 = 180.318 @29/12/2017 9:48:16').should.equal('00', 'postpaid inquiry success'); | 15 | irs.getRcFromMessage('REFF#1238 CEK TAGIHAN PLN16 SUKSES IDPEL:538710624871 Detail: NAMA:MUSHOLLA-NURUL-KHOIR/DAYA:450/TARIF:S2/JMLBLN:1BLN/PERIODE:201712/METERKINI:18984/METERLALU:18932/TAGIHAN:14441/ADM:1600/DENDA:3000/TOTALTAGIHAN:19041 Sisa Saldo: 180.318 - 0 = 180.318 @29/12/2017 9:48:16').should.equal('00', 'postpaid inquiry success'); |
16 | irs.getRcFromMessage('REFF#1239 BAYAR TAGIHAN PLN16 SUKSES IDPEL:538710624871 Detail:S/N:0BNS25G5043265250358/NAMA:MUSHOLLA-NURUL-KHOIR/DAYA:450/TARIF:S2/JMLBLN:1BLNPERIODE:201712/METERKINI:18984/METERLALU:18932/TAGIHAN:14441/ADM:1600/DENDA:3000/TOTALBAYAR:19041 Sisa Saldo: 180.318 - 17.741 = 162.577 @29/12/2017 9:48:41').should.equal('00', 'postpaid payment success'); | 16 | irs.getRcFromMessage('REFF#1239 BAYAR TAGIHAN PLN16 SUKSES IDPEL:538710624871 Detail:S/N:0BNS25G5043265250358/NAMA:MUSHOLLA-NURUL-KHOIR/DAYA:450/TARIF:S2/JMLBLN:1BLNPERIODE:201712/METERKINI:18984/METERLALU:18932/TAGIHAN:14441/ADM:1600/DENDA:3000/TOTALBAYAR:19041 Sisa Saldo: 180.318 - 17.741 = 162.577 @29/12/2017 9:48:41').should.equal('00', 'postpaid payment success'); |
17 | 17 | ||
18 | irs.getRcFromMessage('Maaf Produk sedang gangguan').should.equal('90'); | 18 | irs.getRcFromMessage('Maaf Produk sedang gangguan').should.equal('90'); |
19 | }); | 19 | }); |
20 | }); | 20 | }); |
21 | 21 | ||
22 | describe('#getPriceFromMessage', function() { | 22 | describe('#getPriceFromMessage', function() { |
23 | describe('#generic', function() { | 23 | describe('#generic', function() { |
24 | it('should return correct price', function() { | 24 | it('should return correct price', function() { |
25 | irs.getPriceFromMessage('REFF#11538167 Trx IBP25.085736328877 BERHASIL,Harga: 24.475 SN: 503133415264594 Sisa Saldo: 1.169.227 - 24.475 = 1.144.752 @5/3/2018 1:34:13 PM').should.equal(24475); | 25 | irs.getPriceFromMessage('REFF#11538167 Trx IBP25.085736328877 BERHASIL,Harga: 24.475 SN: 503133415264594 Sisa Saldo: 1.169.227 - 24.475 = 1.144.752 @5/3/2018 1:34:13 PM').should.equal(24475); |
26 | }); | 26 | }); |
27 | 27 | ||
28 | it('should handle postpaid response', () => { | 28 | it('should handle postpaid response', () => { |
29 | irs.getPriceFromMessage('REFF#1238 CEK TAGIHAN PLN16 SUKSES IDPEL:538710624871 Detail: NAMA:MUSHOLLA-NURUL-KHOIR/DAYA:450/TARIF:S2/JMLBLN:1BLN/PERIODE:201712/METERKINI:18984/METERLALU:18932/TAGIHAN:14441/ADM:1600/DENDA:3000/TOTALTAGIHAN:19041 Sisa Saldo: 180.318 - 0 = 180.318 @29/12/2017 9:48:16').should.equal(0, 'postpaid inquiry succces'); | 29 | irs.getPriceFromMessage('REFF#1238 CEK TAGIHAN PLN16 SUKSES IDPEL:538710624871 Detail: NAMA:MUSHOLLA-NURUL-KHOIR/DAYA:450/TARIF:S2/JMLBLN:1BLN/PERIODE:201712/METERKINI:18984/METERLALU:18932/TAGIHAN:14441/ADM:1600/DENDA:3000/TOTALTAGIHAN:19041 Sisa Saldo: 180.318 - 0 = 180.318 @29/12/2017 9:48:16').should.equal(0, 'postpaid inquiry succces'); |
30 | irs.getPriceFromMessage('REFF#1239 BAYAR TAGIHAN PLN16 SUKSES IDPEL:538710624871 Detail:S/N:0BNS25G5043265250358/NAMA:MUSHOLLA-NURUL-KHOIR/DAYA:450/TARIF:S2/JMLBLN:1BLNPERIODE:201712/METERKINI:18984/METERLALU:18932/TAGIHAN:14441/ADM:1600/DENDA:3000/TOTALBAYAR:19041 Sisa Saldo: 180.318 - 17.741 = 162.577 @29/12/2017 9:48:41').should.equal(17741, 'postpaid payment success'); | 30 | irs.getPriceFromMessage('REFF#1239 BAYAR TAGIHAN PLN16 SUKSES IDPEL:538710624871 Detail:S/N:0BNS25G5043265250358/NAMA:MUSHOLLA-NURUL-KHOIR/DAYA:450/TARIF:S2/JMLBLN:1BLNPERIODE:201712/METERKINI:18984/METERLALU:18932/TAGIHAN:14441/ADM:1600/DENDA:3000/TOTALBAYAR:19041 Sisa Saldo: 180.318 - 17.741 = 162.577 @29/12/2017 9:48:41').should.equal(17741, 'postpaid payment success'); |
31 | irs.getPriceFromMessage('REFF#562126 BAYAR TAGIHAN PLN25 SUKSES IDPEL:172000147469 Detail:S/N: 0BNS25G5008509025529/NAMA:MASJID-NURUL-IMAN/DAYA:900/TARIF:S2/JMLBLN:1BLN/PERIODE:201912/METERKINI:19627/METERLALU:19428/TAGIHAN:79340/ADM:2500/DENDA:0/TOTALBAYAR:81840 Sisa Saldo: 1.000.000 - 79.540 = 920.460 @2019/12/20 19:49:21').should.equal(79540); | ||
31 | }) | 32 | }) |
32 | 33 | ||
33 | it('should handle missing price', function() { | 34 | it('should handle missing price', function() { |
34 | should.not.exist(irs.getPriceFromMessage('REFF#11538167 Trx IBP25.085736328877 BERHASIL, SN: 503133415264594 @5/3/2018 1:34:13 PM')); | 35 | should.not.exist(irs.getPriceFromMessage('REFF#11538167 Trx IBP25.085736328877 BERHASIL, SN: 503133415264594 @5/3/2018 1:34:13 PM')); |
35 | }); | 36 | }); |
36 | }); | 37 | }); |
37 | 38 | ||
38 | describe('#eflashtron', function() { | 39 | describe('#eflashtron', function() { |
39 | it('should return correct price', function() { | 40 | it('should return correct price', function() { |
40 | irs.getPriceFromMessage('Trx HT5.08989355280 BERHASIL. SN: 0608211002164754102. Sisa Saldo: 536.581 - 5.265 = 531.316 @08/06/2019 21:10:03 Komplen max. H+7').should.equal(5265); | 41 | irs.getPriceFromMessage('Trx HT5.08989355280 BERHASIL. SN: 0608211002164754102. Sisa Saldo: 536.581 - 5.265 = 531.316 @08/06/2019 21:10:03 Komplen max. H+7').should.equal(5265); |
41 | }); | 42 | }); |
42 | }); | 43 | }); |
43 | 44 | ||
44 | describe('#custom', () => { | 45 | describe('#custom', () => { |
45 | it('should return correct price', () => { | 46 | it('should return correct price', () => { |
46 | const msg = 'HX5 No.087781522208 Berhasil SN:99971113094584 Tgl 2019-13-11 12:31:47.Saldo Anda 495.630 - Rp 5.525 = Rp 490.105'; | 47 | const msg = 'HX5 No.087781522208 Berhasil SN:99971113094584 Tgl 2019-13-11 12:31:47.Saldo Anda 495.630 - Rp 5.525 = Rp 490.105'; |
47 | const rule = { | 48 | const rule = { |
48 | pattern: 'Saldo Anda (?:[\\d\\.]+) - Rp ([\\d\\.]+)', | 49 | pattern: 'Saldo Anda (?:[\\d\\.]+) - Rp ([\\d\\.]+)', |
49 | match_idx: 1, | 50 | match_idx: 1, |
50 | } | 51 | } |
51 | irs.getPriceFromMessage(msg, rule).should.equal(5525); | 52 | irs.getPriceFromMessage(msg, rule).should.equal(5525); |
52 | should.not.exists(irs.getPriceFromMessage('kosong', rule)); | 53 | should.not.exists(irs.getPriceFromMessage('kosong', rule)); |
53 | }); | 54 | }); |
54 | }) | 55 | }) |
55 | }); | 56 | }); |
56 | 57 | ||
57 | describe('#getBalanceFromMessage', () => { | 58 | describe('#getBalanceFromMessage', () => { |
58 | describe('#custom', () => { | 59 | describe('#custom', () => { |
59 | it('should return correct price', () => { | 60 | it('should return correct price', () => { |
60 | const msg = 'HX5 No.087781522208 Berhasil SN:99971113094584 Tgl 2019-13-11 12:31:47.Saldo Anda 495.630 - Rp 5.525 = Rp 490.105'; | 61 | const msg = 'HX5 No.087781522208 Berhasil SN:99971113094584 Tgl 2019-13-11 12:31:47.Saldo Anda 495.630 - Rp 5.525 = Rp 490.105'; |
61 | const rule = { | 62 | const rule = { |
62 | pattern: 'Saldo Anda (?:[\\d\\.]+) - Rp (?:[\\d\\.]+) = Rp ([\\d\\.]+)', | 63 | pattern: 'Saldo Anda (?:[\\d\\.]+) - Rp (?:[\\d\\.]+) = Rp ([\\d\\.]+)', |
63 | match_idx: 1, | 64 | match_idx: 1, |
64 | } | 65 | } |
65 | irs.getBalanceFromMessage(msg, rule).should.equal(490105); | 66 | irs.getBalanceFromMessage(msg, rule).should.equal(490105); |
66 | should.not.exists(irs.getBalanceFromMessage('kosong', rule)); | 67 | should.not.exists(irs.getBalanceFromMessage('kosong', rule)); |
67 | }); | 68 | }); |
68 | }) | 69 | }) |
69 | }); | 70 | }); |
70 | 71 | ||
71 | describe('#getSnFromMessage', () => { | 72 | describe('#getSnFromMessage', () => { |
72 | it('should return correct result', () => { | 73 | it('should return correct result', () => { |
73 | irs.getSnFromMessage('HX5 No.087781522208 Berhasil SN: 99971113094584 Tgl 2019-13-11 12:31:47.Saldo Anda 495.630 - Rp 5.525 = Rp 490.105').should.equal('99971113094584', 'SN: 99971113094584'); | 74 | irs.getSnFromMessage('HX5 No.087781522208 Berhasil SN: 99971113094584 Tgl 2019-13-11 12:31:47.Saldo Anda 495.630 - Rp 5.525 = Rp 490.105').should.equal('99971113094584', 'SN: 99971113094584'); |
74 | irs.getSnFromMessage('HX5 No.087781522208 Berhasil SN:99971113094584 Tgl 2019-13-11 12:31:47.Saldo Anda 495.630 - Rp 5.525 = Rp 490.105').should.equal('99971113094584', 'SN:99971113094584'); | 75 | irs.getSnFromMessage('HX5 No.087781522208 Berhasil SN:99971113094584 Tgl 2019-13-11 12:31:47.Saldo Anda 495.630 - Rp 5.525 = Rp 490.105').should.equal('99971113094584', 'SN:99971113094584'); |
75 | irs.getSnFromMessage('REFF#22955367 BAYAR TAGIHAN PLN25 SUKSES IDPEL:173300992349 Detail:S/N: 0BNS25G5082152526173/NAMA:DONAR-HARHAP/DAYA:900/TARIF:R1M/JMLBLN:2BLN/PERIODE:201910,201911/METERKINI:5508/METERLALU:5508/TAGIHAN:131560/ADM:5000/DENDA:9000/TOTALBAYAR:145560 Sisa Saldo: 40.653.798 - 140.960 = 40.512.838 @2019/11/28 11:44:36') | 76 | irs.getSnFromMessage('REFF#22955367 BAYAR TAGIHAN PLN25 SUKSES IDPEL:173300992349 Detail:S/N: 0BNS25G5082152526173/NAMA:DONAR-HARHAP/DAYA:900/TARIF:R1M/JMLBLN:2BLN/PERIODE:201910,201911/METERKINI:5508/METERLALU:5508/TAGIHAN:131560/ADM:5000/DENDA:9000/TOTALBAYAR:145560 Sisa Saldo: 40.653.798 - 140.960 = 40.512.838 @2019/11/28 11:44:36') |
76 | .should.equal('0BNS25G5082152526173/NAMA:DONAR-HARHAP/DAYA:900/TARIF:R1M/JMLBLN:2BLN/PERIODE:201910,201911/METERKINI:5508/METERLALU:5508/TAGIHAN:131560/ADM:5000/DENDA:9000/TOTALBAYAR:145560', 'kiosbayar postpaid payment'); | 77 | .should.equal('0BNS25G5082152526173/NAMA:DONAR-HARHAP/DAYA:900/TARIF:R1M/JMLBLN:2BLN/PERIODE:201910,201911/METERKINI:5508/METERLALU:5508/TAGIHAN:131560/ADM:5000/DENDA:9000/TOTALBAYAR:145560', 'kiosbayar postpaid payment'); |
77 | }); | 78 | }); |
78 | }); | 79 | }); |
79 | 80 | ||
80 | describe('#getDetailFromMessage', () => { | 81 | describe('#getDetailFromMessage', () => { |
81 | it('should return correct result', () => { | 82 | it('should return correct result', () => { |
82 | irs.getDetailFromMessage('REFF#1238 CEK TAGIHAN PLN16 SUKSES IDPEL:538710624871 Detail: NAMA:MUSHOLLA-NURUL-KHOIR/DAYA:450/TARIF:S2/JMLBLN:1BLN/PERIODE:201712/METERKINI:18984/METERLALU:18932/TAGIHAN:14441/ADM:1600/DENDA:3000/TOTALTAGIHAN:19041 Sisa Saldo: 180.318 - 0 = 180.318 @29/12/2017 9:48:16') | 83 | irs.getDetailFromMessage('REFF#1238 CEK TAGIHAN PLN16 SUKSES IDPEL:538710624871 Detail: NAMA:MUSHOLLA-NURUL-KHOIR/DAYA:450/TARIF:S2/JMLBLN:1BLN/PERIODE:201712/METERKINI:18984/METERLALU:18932/TAGIHAN:14441/ADM:1600/DENDA:3000/TOTALTAGIHAN:19041 Sisa Saldo: 180.318 - 0 = 180.318 @29/12/2017 9:48:16') |
83 | .should.equal('NAMA:MUSHOLLA-NURUL-KHOIR/DAYA:450/TARIF:S2/JMLBLN:1BLN/PERIODE:201712/METERKINI:18984/METERLALU:18932/TAGIHAN:14441/ADM:1600/DENDA:3000/TOTALTAGIHAN:19041', 'postpaid inquiry success'); | 84 | .should.equal('NAMA:MUSHOLLA-NURUL-KHOIR/DAYA:450/TARIF:S2/JMLBLN:1BLN/PERIODE:201712/METERKINI:18984/METERLALU:18932/TAGIHAN:14441/ADM:1600/DENDA:3000/TOTALTAGIHAN:19041', 'postpaid inquiry success'); |
84 | 85 | ||
85 | irs.getDetailFromMessage('REFF#22955367 BAYAR TAGIHAN PLN25 SUKSES IDPEL:173300992349 Detail:S/N: 0BNS25G5082152526173/NAMA:DONAR-HARHAP/DAYA:900/TARIF:R1M/JMLBLN:2BLN/PERIODE:201910,201911/METERKINI:5508/METERLALU:5508/TAGIHAN:131560/ADM:5000/DENDA:9000/TOTALBAYAR:145560 Sisa Saldo: 40.653.798 - 140.960 = 40.512.838 @2019/11/28 11:44:36') | 86 | irs.getDetailFromMessage('REFF#22955367 BAYAR TAGIHAN PLN25 SUKSES IDPEL:173300992349 Detail:S/N: 0BNS25G5082152526173/NAMA:DONAR-HARHAP/DAYA:900/TARIF:R1M/JMLBLN:2BLN/PERIODE:201910,201911/METERKINI:5508/METERLALU:5508/TAGIHAN:131560/ADM:5000/DENDA:9000/TOTALBAYAR:145560 Sisa Saldo: 40.653.798 - 140.960 = 40.512.838 @2019/11/28 11:44:36') |
86 | .should.equal('S/N: 0BNS25G5082152526173/NAMA:DONAR-HARHAP/DAYA:900/TARIF:R1M/JMLBLN:2BLN/PERIODE:201910,201911/METERKINI:5508/METERLALU:5508/TAGIHAN:131560/ADM:5000/DENDA:9000/TOTALBAYAR:145560', 'kiosbayar postpaid payment'); | 87 | .should.equal('S/N: 0BNS25G5082152526173/NAMA:DONAR-HARHAP/DAYA:900/TARIF:R1M/JMLBLN:2BLN/PERIODE:201910,201911/METERKINI:5508/METERLALU:5508/TAGIHAN:131560/ADM:5000/DENDA:9000/TOTALBAYAR:145560', 'kiosbayar postpaid payment'); |
88 | |||
89 | irs.getDetailFromMessage('REFF#561744 CEK TAGIHAN PLN25 SUKSES IDPEL:172000147469 Detail: NAMA:MASJID-NURUL-IMAN/DAYA:900/TARIF:S2/JMLBLN:1BLN/PERIODE:201912/METERKINI:19627/METERLALU:19428/TAGIHAN:79340/ADM:2500/DENDA:0/TOTALTAGIHAN:81840 Sisa Saldo: 1.000.000 - 0 = 1.000.000 @2019/12/20 19:41:21') | ||
90 | .should.equal('NAMA:MASJID-NURUL-IMAN/DAYA:900/TARIF:S2/JMLBLN:1BLN/PERIODE:201912/METERKINI:19627/METERLALU:19428/TAGIHAN:79340/ADM:2500/DENDA:0/TOTALTAGIHAN:81840'); | ||
87 | }); | 91 | }); |
88 | |||
89 | }); | 92 | }); |
90 | 93 | ||
91 | describe('#splitPostpaidDetail', () => { | 94 | describe('#splitPostpaidDetail', () => { |
92 | it('should return correct result - inquiry', () => { | 95 | it('should return correct result - inquiry', () => { |
93 | const detail = 'NAMA:MUSHOLLA-NURUL-KHOIR/DAYA:450/TARIF:S2/JMLBLN:1BLN/PERIODE:201712/METERKINI:18984/METERLALU:18932/TAGIHAN:14441/ADM:1600/DENDA:3000/TOTALTAGIHAN:19041'; | 96 | const detail = 'NAMA:MUSHOLLA-NURUL-KHOIR/DAYA:450/TARIF:S2/JMLBLN:1BLN/PERIODE:201712/METERKINI:18984/METERLALU:18932/TAGIHAN:14441/ADM:1600/DENDA:3000/TOTALTAGIHAN:19041'; |
94 | const splitted = irs.splitPostpaidDetail(detail); | 97 | const splitted = irs.splitPostpaidDetail(detail); |
95 | 98 | ||
96 | splitted.should.ok(); | 99 | splitted.should.ok(); |
97 | splitted.find((item) => item.keyword === 'NAMA').value.should.equal('MUSHOLLA-NURUL-KHOIR'); | 100 | splitted.find((item) => item.keyword === 'NAMA').value.should.equal('MUSHOLLA-NURUL-KHOIR'); |
98 | splitted.find((item) => item.keyword === 'TAGIHAN').value.should.equal('14441'); | 101 | splitted.find((item) => item.keyword === 'TAGIHAN').value.should.equal('14441'); |
99 | splitted.find((item) => item.keyword === 'DENDA').value.should.equal('3000'); | 102 | splitted.find((item) => item.keyword === 'DENDA').value.should.equal('3000'); |
100 | }); | 103 | }); |
101 | 104 | ||
102 | it('should return correct result - pay', () => { | 105 | it('should return correct result - pay', () => { |
103 | const detail = 'S/N: 0BNS25G5082152526173/NAMA:DONAR-HARHAP/DAYA:900/TARIF:R1M/JMLBLN:2BLN/PERIODE:201910,201911/METERKINI:5508/METERLALU:5508/TAGIHAN:131560/ADM:5000/DENDA:9000/TOTALBAYAR:145560'; | 106 | const detail = 'S/N: 0BNS25G5082152526173/NAMA:DONAR-HARHAP/DAYA:900/TARIF:R1M/JMLBLN:2BLN/PERIODE:201910,201911/METERKINI:5508/METERLALU:5508/TAGIHAN:131560/ADM:5000/DENDA:9000/TOTALBAYAR:145560'; |
104 | const splitted = irs.splitPostpaidDetail(detail); | 107 | const splitted = irs.splitPostpaidDetail(detail); |
105 | 108 | ||
106 | splitted.should.ok(); | 109 | splitted.should.ok(); |
107 | splitted.find((item) => item.keyword === 'SN').value.should.equal('0BNS25G5082152526173'); | 110 | splitted.find((item) => item.keyword === 'SN').value.should.equal('0BNS25G5082152526173'); |
108 | splitted.find((item) => item.keyword === 'NAMA').value.should.equal('DONAR-HARHAP'); | 111 | splitted.find((item) => item.keyword === 'NAMA').value.should.equal('DONAR-HARHAP'); |
109 | splitted.find((item) => item.keyword === 'TAGIHAN').value.should.equal('131560'); | 112 | splitted.find((item) => item.keyword === 'TAGIHAN').value.should.equal('131560'); |
110 | splitted.find((item) => item.keyword === 'DENDA').value.should.equal('9000'); | 113 | splitted.find((item) => item.keyword === 'DENDA').value.should.equal('9000'); |
111 | }); | 114 | }); |
112 | }); | 115 | }); |
113 | 116 | ||
114 | describe('#calculateBaseBillAmount', () => { | 117 | describe('#calculateBaseBillAmount', () => { |
115 | it('should return correct value - inquiry', () => { | 118 | it('should return correct value - inquiry', () => { |
116 | const detail = 'NAMA:MUSHOLLA-NURUL-KHOIR/DAYA:450/TARIF:S2/JMLBLN:1BLN/PERIODE:201712/METERKINI:18984/METERLALU:18932/TAGIHAN:14441/ADM:1600/DENDA:3000/TOTALTAGIHAN:19041'; | 119 | const detail = 'NAMA:MUSHOLLA-NURUL-KHOIR/DAYA:450/TARIF:S2/JMLBLN:1BLN/PERIODE:201712/METERKINI:18984/METERLALU:18932/TAGIHAN:14441/ADM:1600/DENDA:3000/TOTALTAGIHAN:19041'; |
117 | const splitted = irs.splitPostpaidDetail(detail); | 120 | const splitted = irs.splitPostpaidDetail(detail); |
118 | 121 | ||
119 | irs.calculateBaseBillAmount(splitted).should.equal(17441); | 122 | irs.calculateBaseBillAmount(splitted).should.equal(17441); |
120 | 123 | ||
121 | }) | 124 | }) |
122 | 125 | ||
123 | it('should return correct value - payment', () => { | 126 | it('should return correct value - payment', () => { |
124 | const detail = 'S/N: 0BNS25G5082152526173/NAMA:DONAR-HARHAP/DAYA:900/TARIF:R1M/JMLBLN:2BLN/PERIODE:201910,201911/METERKINI:5508/METERLALU:5508/TAGIHAN:131560/ADM:5000/DENDA:9000/TOTALBAYAR:145560'; | 127 | const detail = 'S/N: 0BNS25G5082152526173/NAMA:DONAR-HARHAP/DAYA:900/TARIF:R1M/JMLBLN:2BLN/PERIODE:201910,201911/METERKINI:5508/METERLALU:5508/TAGIHAN:131560/ADM:5000/DENDA:9000/TOTALBAYAR:145560'; |
125 | const splitted = irs.splitPostpaidDetail(detail); | 128 | const splitted = irs.splitPostpaidDetail(detail); |
126 | 129 | ||
127 | irs.calculateBaseBillAmount(splitted).should.equal(140560); | 130 | irs.calculateBaseBillAmount(splitted).should.equal(140560); |
128 | 131 | ||
129 | }) | 132 | }) |
130 | }); | 133 | }); |