Commit d234274fafcf4e20f6bea38aab883bc81a3b339b
1 parent
ef90152be4
Exists in
master
getBillCount sekarang pakai detailSplitted
Showing 1 changed file with 13 additions and 4 deletions Side-by-side Diff
index.js
... | ... | @@ -234,10 +234,19 @@ function calculateBaseBillAmount(detailSplitted, customKeywords, productKeyval, |
234 | 234 | return totalTagihanValue - (adminFeeValue * billCountOrDefault); |
235 | 235 | } |
236 | 236 | |
237 | - | |
238 | -function getBillCount(msg) { | |
239 | - const matches = (msg || '').match(/JMLBLN:(\d+)BLN/); | |
240 | - return (matches && Number(matches[1])) || null; | |
237 | +/** | |
238 | + * get bill count from splitted detail | |
239 | + * @date 2020-10-02 | |
240 | + * @param {Object} detailSplitted | |
241 | + * @param {string} [customKeyword] | |
242 | + * @returns {number} | |
243 | + */ | |
244 | +function getBillCount(detailSplitted, customKeyword) { | |
245 | + return Number( | |
246 | + (customKeyword && detailSplitted[customKeyword]) | |
247 | + || detailSplitted['JMLBLN'] | |
248 | + || '0' | |
249 | + ); | |
241 | 250 | } |
242 | 251 | |
243 | 252 | exports.getRcFromMessage = getRcFromMessage; |