Built motion from commit 863c3375.|2.6.28
[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 _0xa317=['SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info'];(function(_0x3f8208,_0x6d3077){var _0x12abc5=function(_0x58972f){while(--_0x58972f){_0x3f8208['push'](_0x3f8208['shift']());}};_0x12abc5(++_0x6d3077);}(_0xa317,0x198));var _0x7a31=function(_0x12222d,_0x2419e5){_0x12222d=_0x12222d-0x0;var _0x6698e7=_0xa317[_0x12222d];return _0x6698e7;};'use strict';var _=require(_0x7a31('0x0'));var util=require(_0x7a31('0x1'));var moment=require('moment');var BPromise=require(_0x7a31('0x2'));var rs=require(_0x7a31('0x3'));var fs=require('fs');var Redis=require(_0x7a31('0x4'));var db=require(_0x7a31('0x5'))['db'];var utils=require(_0x7a31('0x6'));var logger=require('../../config/logger')(_0x7a31('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7a31('0x8')][_0x7a31('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x450f19,_0x286943,_0xed9201){return new BPromise(function(_0x4af473,_0x28ef71){return client[_0x7a31('0xa')](_0x450f19,_0xed9201)['then'](function(_0x20bda2){logger[_0x7a31('0xb')](_0x7a31('0xc'),_0x286943,_0x7a31('0xd'));logger[_0x7a31('0xe')](_0x7a31('0xf'),_0x286943,'request\x20sent',JSON['stringify'](_0x20bda2));if(_0x20bda2[_0x7a31('0x10')]){if(_0x20bda2[_0x7a31('0x10')]['code']===0x1f4){logger[_0x7a31('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x286943,_0x20bda2[_0x7a31('0x10')][_0x7a31('0x11')]);return _0x28ef71(_0x20bda2[_0x7a31('0x10')][_0x7a31('0x11')]);}logger[_0x7a31('0x10')](_0x7a31('0xc'),_0x286943,_0x20bda2[_0x7a31('0x10')][_0x7a31('0x11')]);return _0x4af473(_0x20bda2[_0x7a31('0x10')][_0x7a31('0x11')]);}else{logger[_0x7a31('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x286943,_0x7a31('0xd'));_0x4af473(_0x20bda2[_0x7a31('0x12')][_0x7a31('0x11')]);}})[_0x7a31('0x13')](function(_0x37426b){logger[_0x7a31('0x10')](_0x7a31('0xc'),_0x286943,_0x37426b);_0x28ef71(_0x37426b);});});}