Built motion from commit e0fa946e.|2.6.5
[motion2.git] / server / api / intVtigerField / intVtigerField.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 _0xf910=['jayson/promise','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5a4959,_0x19a402){var _0x25dc35=function(_0x1f6e31){while(--_0x1f6e31){_0x5a4959['push'](_0x5a4959['shift']());}};_0x25dc35(++_0x19a402);}(_0xf910,0x1b1));var _0x0f91=function(_0x447d43,_0x67d9fc){_0x447d43=_0x447d43-0x0;var _0x4b032c=_0xf910[_0x447d43];return _0x4b032c;};'use strict';var _=require(_0x0f91('0x0'));var util=require('util');var moment=require(_0x0f91('0x1'));var BPromise=require('bluebird');var rs=require(_0x0f91('0x2'));var fs=require('fs');var Redis=require(_0x0f91('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0f91('0x4'));var logger=require(_0x0f91('0x5'))(_0x0f91('0x6'));var config=require('../../config/environment');var jayson=require(_0x0f91('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x517abb,_0x2c8df2,_0x1a864e){return new BPromise(function(_0x3fc7bc,_0x38ac7a){return client[_0x0f91('0x8')](_0x517abb,_0x1a864e)[_0x0f91('0x9')](function(_0x2033be){logger[_0x0f91('0xa')](_0x0f91('0xb'),_0x2c8df2,'request\x20sent');logger[_0x0f91('0xc')](_0x0f91('0xd'),_0x2c8df2,_0x0f91('0xe'),JSON[_0x0f91('0xf')](_0x2033be));if(_0x2033be['error']){if(_0x2033be['error']['code']===0x1f4){logger[_0x0f91('0x10')](_0x0f91('0xb'),_0x2c8df2,_0x2033be['error'][_0x0f91('0x11')]);return _0x38ac7a(_0x2033be['error'][_0x0f91('0x11')]);}logger['error'](_0x0f91('0xb'),_0x2c8df2,_0x2033be['error']['message']);return _0x3fc7bc(_0x2033be['error'][_0x0f91('0x11')]);}else{logger[_0x0f91('0xa')](_0x0f91('0xb'),_0x2c8df2,_0x0f91('0xe'));_0x3fc7bc(_0x2033be[_0x0f91('0x12')][_0x0f91('0x11')]);}})[_0x0f91('0x13')](function(_0x260a2c){logger[_0x0f91('0x10')](_0x0f91('0xb'),_0x2c8df2,_0x260a2c);_0x38ac7a(_0x260a2c);});});}