8584286edad804aebd656a11a7ce247f9e7a24ff
[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 _0x5226=['request\x20sent','error','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x8c81c0,_0x57b150){var _0x160a3e=function(_0x10abca){while(--_0x10abca){_0x8c81c0['push'](_0x8c81c0['shift']());}};_0x160a3e(++_0x57b150);}(_0x5226,0x91));var _0x6522=function(_0x5ab975,_0x2a4e4d){_0x5ab975=_0x5ab975-0x0;var _0x3b1df6=_0x5226[_0x5ab975];return _0x3b1df6;};'use strict';var _=require(_0x6522('0x0'));var util=require(_0x6522('0x1'));var moment=require(_0x6522('0x2'));var BPromise=require('bluebird');var rs=require(_0x6522('0x3'));var fs=require('fs');var Redis=require(_0x6522('0x4'));var db=require(_0x6522('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6522('0x6'))(_0x6522('0x7'));var config=require(_0x6522('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6522('0x9')][_0x6522('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b6ef3,_0x58ba64,_0x3081f3){return new BPromise(function(_0x5eae0a,_0x5120b6){return client[_0x6522('0xb')](_0x1b6ef3,_0x3081f3)[_0x6522('0xc')](function(_0x4bb287){logger['info'](_0x6522('0xd'),_0x58ba64,'request\x20sent');logger['debug'](_0x6522('0xe'),_0x58ba64,_0x6522('0xf'),JSON['stringify'](_0x4bb287));if(_0x4bb287['error']){if(_0x4bb287['error']['code']===0x1f4){logger[_0x6522('0x10')](_0x6522('0xd'),_0x58ba64,_0x4bb287[_0x6522('0x10')][_0x6522('0x11')]);return _0x5120b6(_0x4bb287[_0x6522('0x10')][_0x6522('0x11')]);}logger[_0x6522('0x10')](_0x6522('0xd'),_0x58ba64,_0x4bb287[_0x6522('0x10')][_0x6522('0x11')]);return _0x5eae0a(_0x4bb287[_0x6522('0x10')][_0x6522('0x11')]);}else{logger[_0x6522('0x12')](_0x6522('0xd'),_0x58ba64,_0x6522('0xf'));_0x5eae0a(_0x4bb287['result']['message']);}})[_0x6522('0x13')](function(_0x2d2ba8){logger['error'](_0x6522('0xd'),_0x58ba64,_0x2d2ba8);_0x5120b6(_0x2d2ba8);});});}