Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / intSugarcrmField / intSugarcrmField.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 _0x5a15=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x5a15,0x107));var _0x55a1=function(_0x488a1c,_0x5c959c){_0x488a1c=_0x488a1c-0x0;var _0x50215f=_0x5a15[_0x488a1c];return _0x50215f;};'use strict';var _=require(_0x55a1('0x0'));var util=require(_0x55a1('0x1'));var moment=require(_0x55a1('0x2'));var BPromise=require(_0x55a1('0x3'));var rs=require(_0x55a1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55a1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x55a1('0x6'))(_0x55a1('0x7'));var config=require('../../config/environment');var jayson=require(_0x55a1('0x8'));var client=jayson[_0x55a1('0x9')][_0x55a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3766f6,_0x5d3973,_0x1ee1db){return new BPromise(function(_0x149a29,_0x526c11){return client[_0x55a1('0xb')](_0x3766f6,_0x1ee1db)[_0x55a1('0xc')](function(_0x14a932){logger[_0x55a1('0xd')](_0x55a1('0xe'),_0x5d3973,'request\x20sent');logger[_0x55a1('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x5d3973,_0x55a1('0x10'),JSON[_0x55a1('0x11')](_0x14a932));if(_0x14a932[_0x55a1('0x12')]){if(_0x14a932['error']['code']===0x1f4){logger[_0x55a1('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x5d3973,_0x14a932['error']['message']);return _0x526c11(_0x14a932[_0x55a1('0x12')][_0x55a1('0x13')]);}logger['error'](_0x55a1('0xe'),_0x5d3973,_0x14a932[_0x55a1('0x12')][_0x55a1('0x13')]);return _0x149a29(_0x14a932['error'][_0x55a1('0x13')]);}else{logger[_0x55a1('0xd')](_0x55a1('0xe'),_0x5d3973,_0x55a1('0x10'));_0x149a29(_0x14a932[_0x55a1('0x14')]['message']);}})[_0x55a1('0x15')](function(_0x116737){logger[_0x55a1('0x12')](_0x55a1('0xe'),_0x5d3973,_0x116737);_0x526c11(_0x116737);});});}