Commit da1b3450cc5344d41e5aaec9348670828934b5db
1 parent
039a296f27
Exists in
master
parsing
Showing 1 changed file with 29 additions and 0 deletions Side-by-side Diff
partner-bayarkilat.js
... | ... | @@ -88,6 +88,35 @@ function parseResponse(body, task) { |
88 | 88 | } |
89 | 89 | |
90 | 90 | logger.info('Got response', {response: response}); |
91 | + | |
92 | + var responseCode = '68'; | |
93 | + var message = ''; | |
94 | + | |
95 | + try { | |
96 | + responseCode = response.xml.response_code[0]; | |
97 | + saldo = response.xml.saldo[0]; | |
98 | + message = response.xml.response_message[0]; | |
99 | + | |
100 | + var st24rc = '40'; | |
101 | + if (responseCode == '00') { | |
102 | + st24rc = '00'; | |
103 | + } | |
104 | + else if (responseCode == '99') { | |
105 | + st24rc = '68' | |
106 | + } | |
107 | + else { | |
108 | + st24rc = '40'; | |
109 | + } | |
110 | + | |
111 | + var st24message = responseCode + ' ' + message + '. Saldo ' + saldo; | |
112 | + | |
113 | + callbackReport(task.requestId, st24rc, st24message); | |
114 | + } | |
115 | + catch(errGetParam) { | |
116 | + logger.warn('Exception saat parsing hasil', {error: errGetParam, task: task, responseBody: body}); | |
117 | + callbackReport(task.requestId, '68', 'Exception saat parsing hasil. ' + errGetParam); | |
118 | + } | |
119 | + | |
91 | 120 | }); |
92 | 121 | } |
93 | 122 |