04566605d2975485c2e9e67b2eb08fb918875025
[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 _0x4932=['error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x631201,_0x3a6984){var _0x22b22e=function(_0x314cd9){while(--_0x314cd9){_0x631201['push'](_0x631201['shift']());}};_0x22b22e(++_0x3a6984);}(_0x4932,0x147));var _0x2493=function(_0x3e8de2,_0x59c5a3){_0x3e8de2=_0x3e8de2-0x0;var _0x4dd76f=_0x4932[_0x3e8de2];return _0x4dd76f;};'use strict';var _=require(_0x2493('0x0'));var util=require(_0x2493('0x1'));var moment=require('moment');var BPromise=require(_0x2493('0x2'));var rs=require(_0x2493('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2493('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2493('0x5'))(_0x2493('0x6'));var config=require(_0x2493('0x7'));var jayson=require(_0x2493('0x8'));var client=jayson[_0x2493('0x9')][_0x2493('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32e5d2,_0x388c8a,_0x921eb8){return new BPromise(function(_0x3e26ff,_0x2754fd){return client[_0x2493('0xb')](_0x32e5d2,_0x921eb8)[_0x2493('0xc')](function(_0x526c38){logger[_0x2493('0xd')](_0x2493('0xe'),_0x388c8a,'request\x20sent');logger[_0x2493('0xf')](_0x2493('0x10'),_0x388c8a,_0x2493('0x11'),JSON['stringify'](_0x526c38));if(_0x526c38[_0x2493('0x12')]){if(_0x526c38['error'][_0x2493('0x13')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x388c8a,_0x526c38[_0x2493('0x12')][_0x2493('0x14')]);return _0x2754fd(_0x526c38[_0x2493('0x12')][_0x2493('0x14')]);}logger['error'](_0x2493('0xe'),_0x388c8a,_0x526c38[_0x2493('0x12')][_0x2493('0x14')]);return _0x3e26ff(_0x526c38['error']['message']);}else{logger['info'](_0x2493('0xe'),_0x388c8a,'request\x20sent');_0x3e26ff(_0x526c38[_0x2493('0x15')][_0x2493('0x14')]);}})[_0x2493('0x16')](function(_0x1d346b){logger[_0x2493('0x12')](_0x2493('0xe'),_0x388c8a,_0x1d346b);_0x2754fd(_0x1d346b);});});}