Commit 3950ebfdf1f89f9c2b2e3319d8591e0dad69a883
1 parent
36643bcd72
Exists in
master
parsing response dari sds ss
Showing 1 changed file with 15 additions and 7 deletions Side-by-side Diff
lib/http-server/routers/updates/index.js
... | ... | @@ -27,16 +27,24 @@ const pageUpdate = async (req, res) => { |
27 | 27 | |
28 | 28 | try { |
29 | 29 | logger.verbose(`${MODULE_NAME} 9E5C70C8: update from sds`, { xid, data }); |
30 | + const requestIds = data.trxid.split('-'); | |
31 | + let trxId = ''; | |
32 | + if (Array.isArray(requestIds) && requestIds.length > 0) { | |
33 | + trxId = requestIds[requestIds.length - 1]; | |
34 | + } | |
35 | + | |
36 | + let rc = '68'; | |
37 | + if (data.status === 'S') { | |
38 | + rc = '00'; | |
39 | + } else if (data.status === 'F' || data.status === 'R') { | |
40 | + rc = '40'; | |
41 | + } | |
30 | 42 | const params = { |
31 | - id: data.request_id, | |
32 | - rc: data.rc, | |
33 | - amount: data.amount || null, | |
43 | + id: trxId, | |
44 | + rc, | |
34 | 45 | message: data.message, |
35 | 46 | sn: data.sn || null, |
36 | - bill_count: data.bill_count, | |
37 | - bill_amount: data.bill_amount, | |
38 | - related_data: null, | |
39 | - amount_to_charge: data.amount_to_charge, | |
47 | + related_data: JSON.stringify(data), | |
40 | 48 | }; |
41 | 49 | |
42 | 50 | client.post('/transactions/gateway-update', params).then((result) => { |