29bc4007cf4e4f22d116d1bbfc1419df46e90fd6
[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 _0x357b=['jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2ff38c,_0x57bd89){var _0x3cf2e1=function(_0x4e840f){while(--_0x4e840f){_0x2ff38c['push'](_0x2ff38c['shift']());}};_0x3cf2e1(++_0x57bd89);}(_0x357b,0x6c));var _0xb357=function(_0x53509d,_0x66d0f2){_0x53509d=_0x53509d-0x0;var _0x10f555=_0x357b[_0x53509d];return _0x10f555;};'use strict';var _=require(_0xb357('0x0'));var util=require('util');var moment=require(_0xb357('0x1'));var BPromise=require(_0xb357('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb357('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb357('0x4'));var logger=require(_0xb357('0x5'))(_0xb357('0x6'));var config=require('../../config/environment');var jayson=require(_0xb357('0x7'));var client=jayson[_0xb357('0x8')][_0xb357('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16e6db,_0x1b1bf7,_0x2213b2){return new BPromise(function(_0x1bfe97,_0x51b90d){return client[_0xb357('0xa')](_0x16e6db,_0x2213b2)[_0xb357('0xb')](function(_0x35e0e2){logger[_0xb357('0xc')](_0xb357('0xd'),_0x1b1bf7,_0xb357('0xe'));logger[_0xb357('0xf')](_0xb357('0x10'),_0x1b1bf7,_0xb357('0xe'),JSON[_0xb357('0x11')](_0x35e0e2));if(_0x35e0e2[_0xb357('0x12')]){if(_0x35e0e2[_0xb357('0x12')][_0xb357('0x13')]===0x1f4){logger[_0xb357('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x1b1bf7,_0x35e0e2[_0xb357('0x12')][_0xb357('0x14')]);return _0x51b90d(_0x35e0e2[_0xb357('0x12')][_0xb357('0x14')]);}logger['error'](_0xb357('0xd'),_0x1b1bf7,_0x35e0e2[_0xb357('0x12')][_0xb357('0x14')]);return _0x1bfe97(_0x35e0e2['error'][_0xb357('0x14')]);}else{logger[_0xb357('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x1b1bf7,_0xb357('0xe'));_0x1bfe97(_0x35e0e2[_0xb357('0x15')][_0xb357('0x14')]);}})[_0xb357('0x16')](function(_0x1f015b){logger['error'](_0xb357('0xd'),_0x1b1bf7,_0x1f015b);_0x51b90d(_0x1f015b);});});}