549845bbde1745f4ffe2b5f815719782eba7267c
[motion2.git] / server / api / intFreshsalesField / intFreshsalesField.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 _0xfb9f=['client','http','request','then','info','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x33e563,_0x154130){var _0x251baa=function(_0x4373ea){while(--_0x4373ea){_0x33e563['push'](_0x33e563['shift']());}};_0x251baa(++_0x154130);}(_0xfb9f,0x187));var _0xffb9=function(_0x468f11,_0xa9fdb1){_0x468f11=_0x468f11-0x0;var _0x5c69f0=_0xfb9f[_0x468f11];return _0x5c69f0;};'use strict';var _=require('lodash');var util=require(_0xffb9('0x0'));var moment=require(_0xffb9('0x1'));var BPromise=require(_0xffb9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffb9('0x3'))['db'];var utils=require(_0xffb9('0x4'));var logger=require(_0xffb9('0x5'))('rpc');var config=require(_0xffb9('0x6'));var jayson=require(_0xffb9('0x7'));var client=jayson[_0xffb9('0x8')][_0xffb9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d6de6,_0x4f1743,_0x277636){return new BPromise(function(_0x2092a2,_0xd032f){return client[_0xffb9('0xa')](_0x5d6de6,_0x277636)[_0xffb9('0xb')](function(_0x21e952){logger[_0xffb9('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x4f1743,_0xffb9('0xd'));logger[_0xffb9('0xe')](_0xffb9('0xf'),_0x4f1743,_0xffb9('0xd'),JSON[_0xffb9('0x10')](_0x21e952));if(_0x21e952[_0xffb9('0x11')]){if(_0x21e952[_0xffb9('0x11')][_0xffb9('0x12')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x4f1743,_0x21e952[_0xffb9('0x11')][_0xffb9('0x13')]);return _0xd032f(_0x21e952[_0xffb9('0x11')][_0xffb9('0x13')]);}logger['error'](_0xffb9('0x14'),_0x4f1743,_0x21e952[_0xffb9('0x11')][_0xffb9('0x13')]);return _0x2092a2(_0x21e952[_0xffb9('0x11')][_0xffb9('0x13')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4f1743,_0xffb9('0xd'));_0x2092a2(_0x21e952['result'][_0xffb9('0x13')]);}})['catch'](function(_0x364331){logger[_0xffb9('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4f1743,_0x364331);_0xd032f(_0x364331);});});}