da0fd07bd0e769c63627a17d687e802738325755
[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 _0xfe2a=['../../config/environment','jayson/promise','client','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xfe2a,0x10c));var _0xafe2=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0xfe2a[_0x53b53e];return _0xbb6179;};'use strict';var _=require('lodash');var util=require(_0xafe2('0x0'));var moment=require(_0xafe2('0x1'));var BPromise=require('bluebird');var rs=require(_0xafe2('0x2'));var fs=require('fs');var Redis=require(_0xafe2('0x3'));var db=require(_0xafe2('0x4'))['db'];var utils=require(_0xafe2('0x5'));var logger=require(_0xafe2('0x6'))(_0xafe2('0x7'));var config=require(_0xafe2('0x8'));var jayson=require(_0xafe2('0x9'));var client=jayson[_0xafe2('0xa')][_0xafe2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc52c15,_0x4bd352,_0x260e05){return new BPromise(function(_0x50f570,_0x2b9d26){return client[_0xafe2('0xc')](_0xc52c15,_0x260e05)[_0xafe2('0xd')](function(_0x29076d){logger['info'](_0xafe2('0xe'),_0x4bd352,_0xafe2('0xf'));logger[_0xafe2('0x10')](_0xafe2('0x11'),_0x4bd352,_0xafe2('0xf'),JSON['stringify'](_0x29076d));if(_0x29076d[_0xafe2('0x12')]){if(_0x29076d['error']['code']===0x1f4){logger[_0xafe2('0x12')](_0xafe2('0xe'),_0x4bd352,_0x29076d[_0xafe2('0x12')][_0xafe2('0x13')]);return _0x2b9d26(_0x29076d[_0xafe2('0x12')][_0xafe2('0x13')]);}logger['error'](_0xafe2('0xe'),_0x4bd352,_0x29076d['error'][_0xafe2('0x13')]);return _0x50f570(_0x29076d[_0xafe2('0x12')][_0xafe2('0x13')]);}else{logger[_0xafe2('0x14')](_0xafe2('0xe'),_0x4bd352,_0xafe2('0xf'));_0x50f570(_0x29076d[_0xafe2('0x15')][_0xafe2('0x13')]);}})[_0xafe2('0x16')](function(_0x344f35){logger['error'](_0xafe2('0xe'),_0x4bd352,_0x344f35);_0x2b9d26(_0x344f35);});});}