Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / api / cmHopperFinal / cmHopperFinal.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 _0x322f=['body','options','CreateCmHopperFinal','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperFinal,\x20%s,\x20%s','message','catch','CmHopperFinal','create'];(function(_0xdd914f,_0xfa6cd4){var _0x1ee80a=function(_0x483a05){while(--_0x483a05){_0xdd914f['push'](_0xdd914f['shift']());}};_0x1ee80a(++_0xfa6cd4);}(_0x322f,0x1bd));var _0xf322=function(_0x12336a,_0x2085c5){_0x12336a=_0x12336a-0x0;var _0x21d342=_0x322f[_0x12336a];return _0x21d342;};'use strict';var _=require(_0xf322('0x0'));var util=require(_0xf322('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf322('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf322('0x3'));var logger=require(_0xf322('0x4'))(_0xf322('0x5'));var config=require(_0xf322('0x6'));var jayson=require(_0xf322('0x7'));var client=jayson[_0xf322('0x8')][_0xf322('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31a86e,_0xefc004,_0x511723){return new BPromise(function(_0xbcdf7b,_0x5460db){return client[_0xf322('0xa')](_0x31a86e,_0x511723)['then'](function(_0x505a23){logger[_0xf322('0xb')]('CmHopperFinal,\x20%s,\x20%s',_0xefc004,_0xf322('0xc'));logger[_0xf322('0xd')](_0xf322('0xe'),_0xefc004,_0xf322('0xc'),JSON[_0xf322('0xf')](_0x505a23));if(_0x505a23[_0xf322('0x10')]){if(_0x505a23[_0xf322('0x10')][_0xf322('0x11')]===0x1f4){logger[_0xf322('0x10')](_0xf322('0x12'),_0xefc004,_0x505a23[_0xf322('0x10')][_0xf322('0x13')]);return _0x5460db(_0x505a23[_0xf322('0x10')][_0xf322('0x13')]);}logger['error'](_0xf322('0x12'),_0xefc004,_0x505a23[_0xf322('0x10')]['message']);return _0xbcdf7b(_0x505a23[_0xf322('0x10')][_0xf322('0x13')]);}else{logger[_0xf322('0xb')](_0xf322('0x12'),_0xefc004,_0xf322('0xc'));_0xbcdf7b(_0x505a23['result'][_0xf322('0x13')]);}})[_0xf322('0x14')](function(_0x56253f){logger[_0xf322('0x10')](_0xf322('0x12'),_0xefc004,_0x56253f);_0x5460db(_0x56253f);});});}exports['CreateCmHopperFinal']=function(_0x5800ff){var _0x37b853=this;return new Promise(function(_0x5e738a,_0x58b863){return db[_0xf322('0x15')][_0xf322('0x16')](_0x5800ff[_0xf322('0x17')],{'raw':_0x5800ff[_0xf322('0x18')]?_0x5800ff[_0xf322('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x7034ff){logger[_0xf322('0xb')](_0xf322('0x19'),_0x5800ff);logger[_0xf322('0xd')](_0xf322('0x19'),_0x5800ff,JSON[_0xf322('0xf')](_0x7034ff));_0x5e738a(_0x7034ff);})[_0xf322('0x14')](function(_0x263aac){logger[_0xf322('0x10')](_0xf322('0x19'),_0x263aac['message'],_0x5800ff);_0x58b863(_0x37b853[_0xf322('0x10')](0x1f4,_0x263aac[_0xf322('0x13')]));});});};