Commit 36b5eef4d1268aff49e636b596972a0ccc750f97

Authored by Adhidarma Hadiwinoto
1 parent d122ddca88
Exists in master

config.partner.use_sslv3

Showing 2 changed files with 15 additions and 3 deletions 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