ed73f8a40040e7c2a674069c85c1f511576cc144
[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 _0x7bf4=['info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x7bf4,0x15c));var _0x47bf=function(_0x2915ee,_0x25447b){_0x2915ee=_0x2915ee-0x0;var _0x332d00=_0x7bf4[_0x2915ee];return _0x332d00;};'use strict';var _=require('lodash');var util=require(_0x47bf('0x0'));var moment=require('moment');var BPromise=require(_0x47bf('0x1'));var rs=require(_0x47bf('0x2'));var fs=require('fs');var Redis=require(_0x47bf('0x3'));var db=require(_0x47bf('0x4'))['db'];var utils=require(_0x47bf('0x5'));var logger=require(_0x47bf('0x6'))(_0x47bf('0x7'));var config=require(_0x47bf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x47bf('0x9')][_0x47bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38dc97,_0x28a8a5,_0x2a2fe6){return new BPromise(function(_0x4271cd,_0x22536d){return client[_0x47bf('0xb')](_0x38dc97,_0x2a2fe6)['then'](function(_0x2ce0d6){logger[_0x47bf('0xc')](_0x47bf('0xd'),_0x28a8a5,_0x47bf('0xe'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x28a8a5,_0x47bf('0xe'),JSON[_0x47bf('0xf')](_0x2ce0d6));if(_0x2ce0d6[_0x47bf('0x10')]){if(_0x2ce0d6[_0x47bf('0x10')]['code']===0x1f4){logger[_0x47bf('0x10')](_0x47bf('0xd'),_0x28a8a5,_0x2ce0d6[_0x47bf('0x10')]['message']);return _0x22536d(_0x2ce0d6['error'][_0x47bf('0x11')]);}logger['error'](_0x47bf('0xd'),_0x28a8a5,_0x2ce0d6[_0x47bf('0x10')]['message']);return _0x4271cd(_0x2ce0d6[_0x47bf('0x10')][_0x47bf('0x11')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x28a8a5,'request\x20sent');_0x4271cd(_0x2ce0d6[_0x47bf('0x12')][_0x47bf('0x11')]);}})[_0x47bf('0x13')](function(_0x3ae2f8){logger[_0x47bf('0x10')](_0x47bf('0xd'),_0x28a8a5,_0x3ae2f8);_0x22536d(_0x3ae2f8);});});}