Compare View

switch
from
...
to
 
Commits (3)

Changes

Showing 4 changed files Side-by-side Diff

... ... @@ -8,7 +8,8 @@
8 8 "partner": {
9 9 "url": "https://PLEASE_CHANGE_ME:6789/",
10 10 "msisdn": "PLEASE_CHANGE_ME",
11   - "pin": "PLEASE_CHANGE_ME"
  11 + "pin": "PLEASE_CHANGE_ME",
  12 + "use_sslv3": false
12 13 },
13 14 "remote_products": {
14 15 "PLEASE_CHANGE_ME": "PLEASE_CHANGE_ME"
... ... @@ -3,6 +3,7 @@
3 3 process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
4 4  
5 5 const url = require('url');
  6 +const https = require('https');
6 7 const xmlrpc = require('xmlrpc');
7 8  
8 9 const config = require('komodo-sdk/config');
... ... @@ -13,6 +14,10 @@ const pull = require('komodo-sdk/gateway/pull');
13 14 const st24 = require('./st24');
14 15 const partnerRc = require('./partner-rc.json');
15 16  
  17 +if (config.partner.use_sslv3) {
  18 + https.globalAgent.options.secureProtocol = 'SSLv3_method';
  19 +}
  20 +
16 21 function buy(task) {
17 22 const partnerUrl = url.parse(config.partner.url);
18 23 const clientOptions = {
... ... @@ -42,10 +47,16 @@ function buy(task) {
42 47 client.methodCall(xmlrpcMethod, [ params ], function (err, value) {
43 48  
44 49 if (err) {
45   - let rc = '68';
  50 +
46 51 let msg = 'XMLRPC Client Error: ' + err;
  52 + let rc = '68';
47 53  
48   - if (error.code == 'ECONNREFUSED' || error.code == 'EHOSTUNREACH' || (error.code == 'ETIMEDOUT' && error.syscall == "connect")) {
  54 + if (
  55 + err.code === 'ECONNREFUSED'
  56 + || err.code === 'EHOSTUNREACH'
  57 + || (err.code === 'ETIMEDOUT' && err.syscall === "connect")
  58 + || (err.code === 'EPROTO' && err.syscall === "write")
  59 + ) {
49 60 rc = '91';
50 61 }
51 62  
... ... @@ -69,7 +80,7 @@ function buy(task) {
69 80 trx_id: task.trx_id,
70 81 rc: partnerRc[value.RESPONSECODE] || '40',
71 82 message: value.MESSAGE,
72   - sn: value.SN || st24.extractSnFromMessage(value.MESSAGE),
  83 + sn: (value.SN || '').replace(/;$/, '') || st24.extractSnFromMessage(value.MESSAGE),
73 84 amount: value.PRICE || st24.extractPriceFromMsg(value.MESSAGE),
74 85 raw: value,
75 86 misc: {
lib/reverse-report.js
... ... @@ -35,7 +35,7 @@ function create() {
35 35 trx_id: value.REQUESTID,
36 36 rc: partnerRc[value.RESPONSECODE] || '40',
37 37 message: value.MESSAGE,
38   - sn: value.SN || st24.extractSnFromMessage(value.MESSAGE),
  38 + sn: (value.SN || '').replace(/;$/, '') || st24.extractSnFromMessage(value.MESSAGE),
39 39 amount: value.PRICE || st24.extractPriceFromMsg(value.MESSAGE),
40 40 raw: value,
41 41 misc: {
1 1 {
2 2 "name": "komodo-gw-st24",
3   - "version": "1.0.1",
  3 + "version": "1.0.2",
4 4 "description": "Komodo Gateway to ST24 XML-RPC",
5 5 "main": "index.js",
6 6 "scripts": {