817087a5bc8a570bb6f5dd9d4a92f9162c813cde
[motion2.git] / server / api / intFreshsalesConfiguration / intFreshsalesConfiguration.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x03f1=['../../config/environment','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','ioredis','../../config/logger'];(function(_0x5a89f4,_0x1bf871){var _0x3921c9=function(_0x4c9b29){while(--_0x4c9b29){_0x5a89f4['push'](_0x5a89f4['shift']());}};_0x3921c9(++_0x1bf871);}(_0x03f1,0x10d));var _0x103f=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x03f1[_0x21549c];return _0x426cbd;};'use strict';var _=require('lodash');var util=require(_0x103f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x103f('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x103f('0x2'))('rpc');var config=require(_0x103f('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x103f('0x4')][_0x103f('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x87cbb9,_0x2b5770,_0x5301dc){return new BPromise(function(_0x2b9bbf,_0x360fbc){return client[_0x103f('0x6')](_0x87cbb9,_0x5301dc)[_0x103f('0x7')](function(_0x15501b){logger[_0x103f('0x8')](_0x103f('0x9'),_0x2b5770,_0x103f('0xa'));logger['debug'](_0x103f('0xb'),_0x2b5770,'request\x20sent',JSON[_0x103f('0xc')](_0x15501b));if(_0x15501b[_0x103f('0xd')]){if(_0x15501b[_0x103f('0xd')]['code']===0x1f4){logger[_0x103f('0xd')](_0x103f('0x9'),_0x2b5770,_0x15501b['error'][_0x103f('0xe')]);return _0x360fbc(_0x15501b[_0x103f('0xd')]['message']);}logger[_0x103f('0xd')](_0x103f('0x9'),_0x2b5770,_0x15501b[_0x103f('0xd')][_0x103f('0xe')]);return _0x2b9bbf(_0x15501b['error'][_0x103f('0xe')]);}else{logger[_0x103f('0x8')](_0x103f('0x9'),_0x2b5770,_0x103f('0xa'));_0x2b9bbf(_0x15501b[_0x103f('0xf')][_0x103f('0xe')]);}})[_0x103f('0x10')](function(_0x147ac7){logger[_0x103f('0xd')](_0x103f('0x9'),_0x2b5770,_0x147ac7);_0x360fbc(_0x147ac7);});});}