706b7d03deea75a40a934918404de720d0ee2776
[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 _0xd738=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','result','lodash','util'];(function(_0x486f6b,_0x7db838){var _0x45c03c=function(_0x2cb178){while(--_0x2cb178){_0x486f6b['push'](_0x486f6b['shift']());}};_0x45c03c(++_0x7db838);}(_0xd738,0x19c));var _0x8d73=function(_0x4ac1fc,_0x2315c6){_0x4ac1fc=_0x4ac1fc-0x0;var _0x1c2165=_0xd738[_0x4ac1fc];return _0x1c2165;};'use strict';var _=require(_0x8d73('0x0'));var util=require(_0x8d73('0x1'));var moment=require(_0x8d73('0x2'));var BPromise=require(_0x8d73('0x3'));var rs=require(_0x8d73('0x4'));var fs=require('fs');var Redis=require(_0x8d73('0x5'));var db=require(_0x8d73('0x6'))['db'];var utils=require(_0x8d73('0x7'));var logger=require(_0x8d73('0x8'))(_0x8d73('0x9'));var config=require('../../config/environment');var jayson=require(_0x8d73('0xa'));var client=jayson[_0x8d73('0xb')][_0x8d73('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x448567,_0x365669,_0x19fe44){return new BPromise(function(_0x5639b6,_0x6d021f){return client[_0x8d73('0xd')](_0x448567,_0x19fe44)['then'](function(_0x4e9445){logger[_0x8d73('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x365669,_0x8d73('0xf'));logger['debug'](_0x8d73('0x10'),_0x365669,_0x8d73('0xf'),JSON[_0x8d73('0x11')](_0x4e9445));if(_0x4e9445[_0x8d73('0x12')]){if(_0x4e9445[_0x8d73('0x12')][_0x8d73('0x13')]===0x1f4){logger[_0x8d73('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x365669,_0x4e9445[_0x8d73('0x12')][_0x8d73('0x14')]);return _0x6d021f(_0x4e9445[_0x8d73('0x12')][_0x8d73('0x14')]);}logger[_0x8d73('0x12')](_0x8d73('0x15'),_0x365669,_0x4e9445[_0x8d73('0x12')][_0x8d73('0x14')]);return _0x5639b6(_0x4e9445[_0x8d73('0x12')][_0x8d73('0x14')]);}else{logger[_0x8d73('0xe')](_0x8d73('0x15'),_0x365669,_0x8d73('0xf'));_0x5639b6(_0x4e9445[_0x8d73('0x16')][_0x8d73('0x14')]);}})['catch'](function(_0x508ac9){logger[_0x8d73('0x12')](_0x8d73('0x15'),_0x365669,_0x508ac9);_0x6d021f(_0x508ac9);});});}