d722a6226c0b281455dfa332a5b1fe6cdbf0d328
[motion2.git] / server / api / crmTask / crmTask.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 _0xac35=['../../config/environment','jayson/promise','client','http','request','info','request\x20sent','CrmTask,\x20%s,\x20%s,\x20%s','stringify','error','code','CrmTask,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger'];(function(_0x518ccc,_0x283328){var _0x1b4e2e=function(_0x3c0a70){while(--_0x3c0a70){_0x518ccc['push'](_0x518ccc['shift']());}};_0x1b4e2e(++_0x283328);}(_0xac35,0x120));var _0x5ac3=function(_0x16498d,_0x116aa6){_0x16498d=_0x16498d-0x0;var _0xd1bd44=_0xac35[_0x16498d];return _0xd1bd44;};'use strict';var _=require(_0x5ac3('0x0'));var util=require(_0x5ac3('0x1'));var moment=require(_0x5ac3('0x2'));var BPromise=require(_0x5ac3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5ac3('0x4'));var logger=require(_0x5ac3('0x5'))('rpc');var config=require(_0x5ac3('0x6'));var jayson=require(_0x5ac3('0x7'));var client=jayson[_0x5ac3('0x8')][_0x5ac3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25d4cc,_0x4655d2,_0x1e5124){return new BPromise(function(_0x1c3951,_0x423b17){return client[_0x5ac3('0xa')](_0x25d4cc,_0x1e5124)['then'](function(_0x4ec2d4){logger[_0x5ac3('0xb')]('CrmTask,\x20%s,\x20%s',_0x4655d2,_0x5ac3('0xc'));logger['debug'](_0x5ac3('0xd'),_0x4655d2,'request\x20sent',JSON[_0x5ac3('0xe')](_0x4ec2d4));if(_0x4ec2d4[_0x5ac3('0xf')]){if(_0x4ec2d4[_0x5ac3('0xf')][_0x5ac3('0x10')]===0x1f4){logger['error'](_0x5ac3('0x11'),_0x4655d2,_0x4ec2d4['error'][_0x5ac3('0x12')]);return _0x423b17(_0x4ec2d4['error'][_0x5ac3('0x12')]);}logger[_0x5ac3('0xf')](_0x5ac3('0x11'),_0x4655d2,_0x4ec2d4[_0x5ac3('0xf')][_0x5ac3('0x12')]);return _0x1c3951(_0x4ec2d4['error'][_0x5ac3('0x12')]);}else{logger['info'](_0x5ac3('0x11'),_0x4655d2,_0x5ac3('0xc'));_0x1c3951(_0x4ec2d4[_0x5ac3('0x13')][_0x5ac3('0x12')]);}})[_0x5ac3('0x14')](function(_0x3797fb){logger[_0x5ac3('0xf')]('CrmTask,\x20%s,\x20%s',_0x4655d2,_0x3797fb);_0x423b17(_0x3797fb);});});}