Built motion from commit (unavailable).|2.5.16
[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 _0xb4fb=['options','raw','CreateCmHopperFinal','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','CmHopperFinal','body'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb4fb,0xa6));var _0xbb4f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb4fb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xbb4f('0x0'));var util=require(_0xbb4f('0x1'));var moment=require(_0xbb4f('0x2'));var BPromise=require(_0xbb4f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb4f('0x4'));var db=require(_0xbb4f('0x5'))['db'];var utils=require(_0xbb4f('0x6'));var logger=require(_0xbb4f('0x7'))('rpc');var config=require(_0xbb4f('0x8'));var jayson=require(_0xbb4f('0x9'));var client=jayson['client'][_0xbb4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6ec40b,_0x2ad138,_0x541f30){return new BPromise(function(_0x15b8e7,_0x5de709){return client[_0xbb4f('0xb')](_0x6ec40b,_0x541f30)[_0xbb4f('0xc')](function(_0x41b81b){logger[_0xbb4f('0xd')](_0xbb4f('0xe'),_0x2ad138,'request\x20sent');logger[_0xbb4f('0xf')](_0xbb4f('0x10'),_0x2ad138,'request\x20sent',JSON['stringify'](_0x41b81b));if(_0x41b81b[_0xbb4f('0x11')]){if(_0x41b81b[_0xbb4f('0x11')]['code']===0x1f4){logger[_0xbb4f('0x11')](_0xbb4f('0xe'),_0x2ad138,_0x41b81b['error'][_0xbb4f('0x12')]);return _0x5de709(_0x41b81b['error']['message']);}logger[_0xbb4f('0x11')]('CmHopperFinal,\x20%s,\x20%s',_0x2ad138,_0x41b81b[_0xbb4f('0x11')][_0xbb4f('0x12')]);return _0x15b8e7(_0x41b81b[_0xbb4f('0x11')][_0xbb4f('0x12')]);}else{logger['info'](_0xbb4f('0xe'),_0x2ad138,_0xbb4f('0x13'));_0x15b8e7(_0x41b81b['result']['message']);}})[_0xbb4f('0x14')](function(_0x3328b0){logger['error'](_0xbb4f('0xe'),_0x2ad138,_0x3328b0);_0x5de709(_0x3328b0);});});}exports['CreateCmHopperFinal']=function(_0x4d6f17){var _0x423765=this;return new Promise(function(_0x57cfff,_0x4063f9){return db[_0xbb4f('0x15')]['create'](_0x4d6f17[_0xbb4f('0x16')],{'raw':_0x4d6f17[_0xbb4f('0x17')]?_0x4d6f17[_0xbb4f('0x17')][_0xbb4f('0x18')]===undefined?!![]:![]:!![]})[_0xbb4f('0xc')](function(_0x3ffdcc){logger[_0xbb4f('0xd')](_0xbb4f('0x19'),_0x4d6f17);logger[_0xbb4f('0xf')](_0xbb4f('0x19'),_0x4d6f17,JSON[_0xbb4f('0x1a')](_0x3ffdcc));_0x57cfff(_0x3ffdcc);})[_0xbb4f('0x14')](function(_0xe5e576){logger[_0xbb4f('0x11')]('CreateCmHopperFinal',_0xe5e576[_0xbb4f('0x12')],_0x4d6f17);_0x4063f9(_0x423765[_0xbb4f('0x11')](0x1f4,_0xe5e576[_0xbb4f('0x12')]));});});};