Built motion from commit 6db1674d.|2.6.23
[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 _0xd1f5=['info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','debug','request\x20sent','error','code','SugarcrmField,\x20%s,\x20%s','message'];(function(_0x23303f,_0x927d66){var _0x4d6bbb=function(_0x23bc11){while(--_0x23bc11){_0x23303f['push'](_0x23303f['shift']());}};_0x4d6bbb(++_0x927d66);}(_0xd1f5,0x13e));var _0x5d1f=function(_0x9dbd0d,_0x4fe187){_0x9dbd0d=_0x9dbd0d-0x0;var _0x38deae=_0xd1f5[_0x9dbd0d];return _0x38deae;};'use strict';var _=require(_0x5d1f('0x0'));var util=require(_0x5d1f('0x1'));var moment=require('moment');var BPromise=require(_0x5d1f('0x2'));var rs=require(_0x5d1f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d1f('0x4'))['db'];var utils=require(_0x5d1f('0x5'));var logger=require(_0x5d1f('0x6'))(_0x5d1f('0x7'));var config=require('../../config/environment');var jayson=require(_0x5d1f('0x8'));var client=jayson[_0x5d1f('0x9')][_0x5d1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b4e9d,_0x298a42,_0x372dff){return new BPromise(function(_0x9782f2,_0x299b81){return client['request'](_0x1b4e9d,_0x372dff)[_0x5d1f('0xb')](function(_0xd2e10a){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x298a42,'request\x20sent');logger[_0x5d1f('0xc')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x298a42,_0x5d1f('0xd'),JSON['stringify'](_0xd2e10a));if(_0xd2e10a[_0x5d1f('0xe')]){if(_0xd2e10a[_0x5d1f('0xe')][_0x5d1f('0xf')]===0x1f4){logger[_0x5d1f('0xe')](_0x5d1f('0x10'),_0x298a42,_0xd2e10a[_0x5d1f('0xe')][_0x5d1f('0x11')]);return _0x299b81(_0xd2e10a[_0x5d1f('0xe')][_0x5d1f('0x11')]);}logger[_0x5d1f('0xe')](_0x5d1f('0x10'),_0x298a42,_0xd2e10a[_0x5d1f('0xe')][_0x5d1f('0x11')]);return _0x9782f2(_0xd2e10a[_0x5d1f('0xe')][_0x5d1f('0x11')]);}else{logger[_0x5d1f('0x12')](_0x5d1f('0x10'),_0x298a42,'request\x20sent');_0x9782f2(_0xd2e10a[_0x5d1f('0x13')][_0x5d1f('0x11')]);}})[_0x5d1f('0x14')](function(_0x314540){logger[_0x5d1f('0xe')](_0x5d1f('0x10'),_0x298a42,_0x314540);_0x299b81(_0x314540);});});}