Built motion from commit (unavailable).|2.5.31
[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 _0xcc87=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash'];(function(_0x1f07e1,_0x1a5b41){var _0x37e28f=function(_0x414878){while(--_0x414878){_0x1f07e1['push'](_0x1f07e1['shift']());}};_0x37e28f(++_0x1a5b41);}(_0xcc87,0x158));var _0x7cc8=function(_0x4f01cb,_0x36a1ae){_0x4f01cb=_0x4f01cb-0x0;var _0x4b3be5=_0xcc87[_0x4f01cb];return _0x4b3be5;};'use strict';var _=require(_0x7cc8('0x0'));var util=require('util');var moment=require(_0x7cc8('0x1'));var BPromise=require(_0x7cc8('0x2'));var rs=require(_0x7cc8('0x3'));var fs=require('fs');var Redis=require(_0x7cc8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cc8('0x5'));var logger=require(_0x7cc8('0x6'))(_0x7cc8('0x7'));var config=require(_0x7cc8('0x8'));var jayson=require(_0x7cc8('0x9'));var client=jayson[_0x7cc8('0xa')][_0x7cc8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c2822,_0x48ef54,_0x1a751c){return new BPromise(function(_0x2672ee,_0x116dfd){return client[_0x7cc8('0xc')](_0x1c2822,_0x1a751c)['then'](function(_0x4e5271){logger[_0x7cc8('0xd')](_0x7cc8('0xe'),_0x48ef54,'request\x20sent');logger[_0x7cc8('0xf')](_0x7cc8('0x10'),_0x48ef54,_0x7cc8('0x11'),JSON[_0x7cc8('0x12')](_0x4e5271));if(_0x4e5271[_0x7cc8('0x13')]){if(_0x4e5271['error'][_0x7cc8('0x14')]===0x1f4){logger[_0x7cc8('0x13')](_0x7cc8('0xe'),_0x48ef54,_0x4e5271[_0x7cc8('0x13')][_0x7cc8('0x15')]);return _0x116dfd(_0x4e5271[_0x7cc8('0x13')]['message']);}logger[_0x7cc8('0x13')](_0x7cc8('0xe'),_0x48ef54,_0x4e5271[_0x7cc8('0x13')][_0x7cc8('0x15')]);return _0x2672ee(_0x4e5271[_0x7cc8('0x13')][_0x7cc8('0x15')]);}else{logger[_0x7cc8('0xd')](_0x7cc8('0xe'),_0x48ef54,'request\x20sent');_0x2672ee(_0x4e5271[_0x7cc8('0x16')][_0x7cc8('0x15')]);}})['catch'](function(_0x3e725a){logger[_0x7cc8('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x48ef54,_0x3e725a);_0x116dfd(_0x3e725a);});});}