34a5c58c1160c7b2e5852e2535cd9869701dce13
[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 _0x84b7=['request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x84b7,0x1ed));var _0x784b=function(_0x188703,_0x596b26){_0x188703=_0x188703-0x0;var _0x1a0c81=_0x84b7[_0x188703];return _0x1a0c81;};'use strict';var _=require('lodash');var util=require(_0x784b('0x0'));var moment=require(_0x784b('0x1'));var BPromise=require(_0x784b('0x2'));var rs=require(_0x784b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x784b('0x4'))['db'];var utils=require(_0x784b('0x5'));var logger=require(_0x784b('0x6'))(_0x784b('0x7'));var config=require('../../config/environment');var jayson=require(_0x784b('0x8'));var client=jayson[_0x784b('0x9')][_0x784b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14e364,_0x557945,_0x439c08){return new BPromise(function(_0x57b1b0,_0x5c70f0){return client[_0x784b('0xb')](_0x14e364,_0x439c08)[_0x784b('0xc')](function(_0x21ae85){logger['info'](_0x784b('0xd'),_0x557945,_0x784b('0xe'));logger['debug'](_0x784b('0xf'),_0x557945,_0x784b('0xe'),JSON[_0x784b('0x10')](_0x21ae85));if(_0x21ae85[_0x784b('0x11')]){if(_0x21ae85[_0x784b('0x11')][_0x784b('0x12')]===0x1f4){logger[_0x784b('0x11')](_0x784b('0xd'),_0x557945,_0x21ae85[_0x784b('0x11')]['message']);return _0x5c70f0(_0x21ae85[_0x784b('0x11')][_0x784b('0x13')]);}logger[_0x784b('0x11')](_0x784b('0xd'),_0x557945,_0x21ae85[_0x784b('0x11')][_0x784b('0x13')]);return _0x57b1b0(_0x21ae85[_0x784b('0x11')][_0x784b('0x13')]);}else{logger[_0x784b('0x14')](_0x784b('0xd'),_0x557945,_0x784b('0xe'));_0x57b1b0(_0x21ae85['result'][_0x784b('0x13')]);}})['catch'](function(_0x9fbfea){logger[_0x784b('0x11')](_0x784b('0xd'),_0x557945,_0x9fbfea);_0x5c70f0(_0x9fbfea);});});}