Commit 23feb712c5a1ddc73f8068000db0e743a50a24b1

Authored by Adhidarma Hadiwinoto
1 parent 5889434ad6
Exists in master

getResponseCodeByMessage

Showing 1 changed file with 17 additions and 15 deletions Side-by-side Diff

... ... @@ -70,7 +70,7 @@ function createXMLRPCServer() {
70 70 }
71 71  
72 72 if (value['RESPONSECODE'] != '00' && value['RESPONSECODE'] != '68') {
73   - value['RESPONSECODE'] = '40';
  73 + value['RESPONSECODE'] = getResponseCodeByMessage(value['MESSAGE']);
74 74 }
75 75  
76 76 pushResponseToMongoDb(dummyTask, {ts: responseTs, supplier: config.globals.gateway_name, raw: JSON.stringify(value), parsed: value}, value['RESPONSECODE']);
... ... @@ -82,6 +82,21 @@ function createXMLRPCServer() {
82 82 })
83 83 }
84 84  
  85 +function getResponseCodeByMessage(msg) {
  86 + if (msg.indexOf("Trx XL-AXIS NO SALAH") >= 0) {
  87 + return '14';
  88 + }
  89 + else if (msg.indexOf("gagal Nomer salah/Nomer Belum Aktif") >= 0) {
  90 + return '14';
  91 + }
  92 + else if (msg.indexOf("GAGAL NOMER SALAH") >= 0) {
  93 + return '14';
  94 + }
  95 + else {
  96 + return '40'
  97 + }
  98 +}
  99 +
85 100 function topupRequestHttpGet(task, retry) {
86 101  
87 102 var options = {
... ... @@ -183,20 +198,7 @@ function topupRequestXMLRPC(task, retry) {
183 198 */
184 199  
185 200 if (value['RESPONSECODE'] != '00' && value['RESPONSECODE'] != '68') {
186   -
187   - if (value['MESSAGE'].indexOf("Trx XL-AXIS NO SALAH") >= 0) {
188   - value['RESPONSECODE'] = '14';
189   - }
190   - else if (value['MESSAGE'].indexOf("gagal Nomer salah/Nomer Belum Aktif") >= 0) {
191   - value['RESPONSECODE'] = '14';
192   - }
193   - else if (value['MESSAGE'].indexOf("GAGAL NOMER SALAH") >= 0) {
194   - value['RESPONSECODE'] = '14';
195   - }
196   - else {
197   - value['RESPONSECODE'] = '40';
198   - }
199   -
  201 + value['RESPONSECODE'] = getResponseCodeByMessage(value['MESSAGE']);
200 202 }
201 203  
202 204 /*