Built motion from commit (unavailable).|2.0.82
[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 _0x5890=['jayson/promise','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperFinal','CmHopperFinal','body','options','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x312eea,_0x3383b2){var _0x35cdce=function(_0x200c2e){while(--_0x200c2e){_0x312eea['push'](_0x312eea['shift']());}};_0x35cdce(++_0x3383b2);}(_0x5890,0xf2));var _0x0589=function(_0x5f1ae9,_0x483a5f){_0x5f1ae9=_0x5f1ae9-0x0;var _0x1b20ed=_0x5890[_0x5f1ae9];return _0x1b20ed;};'use strict';var _=require(_0x0589('0x0'));var util=require(_0x0589('0x1'));var moment=require(_0x0589('0x2'));var BPromise=require('bluebird');var rs=require(_0x0589('0x3'));var fs=require('fs');var db=require(_0x0589('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0589('0x5'))(_0x0589('0x6'));var config=require(_0x0589('0x7'));var jayson=require(_0x0589('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x397ec5,_0x58169e,_0x11ee98){return new BPromise(function(_0x16a7c7,_0x393069){return client[_0x0589('0x9')](_0x397ec5,_0x11ee98)[_0x0589('0xa')](function(_0x5a4301){logger[_0x0589('0xb')](_0x0589('0xc'),_0x58169e,_0x0589('0xd'));logger[_0x0589('0xe')](_0x0589('0xf'),_0x58169e,'request\x20sent',JSON[_0x0589('0x10')](_0x5a4301));if(_0x5a4301[_0x0589('0x11')]){if(_0x5a4301[_0x0589('0x11')][_0x0589('0x12')]===0x1f4){logger[_0x0589('0x11')](_0x0589('0xc'),_0x58169e,_0x5a4301[_0x0589('0x11')][_0x0589('0x13')]);return _0x393069(_0x5a4301[_0x0589('0x11')][_0x0589('0x13')]);}logger[_0x0589('0x11')](_0x0589('0xc'),_0x58169e,_0x5a4301['error']['message']);return _0x16a7c7(_0x5a4301[_0x0589('0x11')][_0x0589('0x13')]);}else{logger['info'](_0x0589('0xc'),_0x58169e,_0x0589('0xd'));_0x16a7c7(_0x5a4301[_0x0589('0x14')][_0x0589('0x13')]);}})['catch'](function(_0x495613){logger[_0x0589('0x11')]('CmHopperFinal,\x20%s,\x20%s',_0x58169e,_0x495613);_0x393069(_0x495613);});});}exports[_0x0589('0x15')]=function(_0x5bd253){var _0x5ae44b=this;return new Promise(function(_0x1c7f3a,_0x1af3fd){return db[_0x0589('0x16')]['create'](_0x5bd253[_0x0589('0x17')],{'raw':_0x5bd253[_0x0589('0x18')]?_0x5bd253[_0x0589('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x0589('0xa')](function(_0x4c5e91){logger[_0x0589('0xb')](_0x0589('0x15'),_0x5bd253);logger[_0x0589('0xe')](_0x0589('0x15'),_0x5bd253,JSON[_0x0589('0x10')](_0x4c5e91));_0x1c7f3a(_0x4c5e91);})['catch'](function(_0x40e1c0){logger[_0x0589('0x11')](_0x0589('0x15'),_0x40e1c0[_0x0589('0x13')],_0x5bd253);_0x1af3fd(_0x5ae44b[_0x0589('0x11')](0x1f4,_0x40e1c0[_0x0589('0x13')]));});});};