a7794474117fa354e6f1b459d23c8c3cf317298b
[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 _0x7579=['jayson/promise','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x445a7d,_0x2feb68){var _0x5808f0=function(_0x440df3){while(--_0x440df3){_0x445a7d['push'](_0x445a7d['shift']());}};_0x5808f0(++_0x2feb68);}(_0x7579,0x185));var _0x9757=function(_0x45c361,_0x18e641){_0x45c361=_0x45c361-0x0;var _0x349347=_0x7579[_0x45c361];return _0x349347;};'use strict';var _=require(_0x9757('0x0'));var util=require(_0x9757('0x1'));var moment=require(_0x9757('0x2'));var BPromise=require(_0x9757('0x3'));var rs=require(_0x9757('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9757('0x5'))['db'];var utils=require(_0x9757('0x6'));var logger=require(_0x9757('0x7'))(_0x9757('0x8'));var config=require(_0x9757('0x9'));var jayson=require(_0x9757('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x557a4b,_0x2b1734,_0x5e9d22){return new BPromise(function(_0x51c4ae,_0x1d6d5f){return client[_0x9757('0xb')](_0x557a4b,_0x5e9d22)[_0x9757('0xc')](function(_0x2039f1){logger['info'](_0x9757('0xd'),_0x2b1734,_0x9757('0xe'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2b1734,_0x9757('0xe'),JSON[_0x9757('0xf')](_0x2039f1));if(_0x2039f1[_0x9757('0x10')]){if(_0x2039f1[_0x9757('0x10')][_0x9757('0x11')]===0x1f4){logger[_0x9757('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x2b1734,_0x2039f1[_0x9757('0x10')][_0x9757('0x12')]);return _0x1d6d5f(_0x2039f1[_0x9757('0x10')][_0x9757('0x12')]);}logger[_0x9757('0x10')](_0x9757('0xd'),_0x2b1734,_0x2039f1['error'][_0x9757('0x12')]);return _0x51c4ae(_0x2039f1['error'][_0x9757('0x12')]);}else{logger[_0x9757('0x13')](_0x9757('0xd'),_0x2b1734,_0x9757('0xe'));_0x51c4ae(_0x2039f1[_0x9757('0x14')][_0x9757('0x12')]);}})['catch'](function(_0x6f9b21){logger['error'](_0x9757('0xd'),_0x2b1734,_0x6f9b21);_0x1d6d5f(_0x6f9b21);});});}