Built motion from commit (unavailable).|2.0.81
[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 _0x6667=['util','moment','bluebird','randomstring','../../mysqldb','rpc','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CmHopperFinal','create','body','options','CreateCmHopperFinal','catch','lodash'];(function(_0x103026,_0x5f7bed){var _0x27d2fb=function(_0x1f7b38){while(--_0x1f7b38){_0x103026['push'](_0x103026['shift']());}};_0x27d2fb(++_0x5f7bed);}(_0x6667,0x11d));var _0x7666=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x6667[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require(_0x7666('0x0'));var util=require(_0x7666('0x1'));var moment=require(_0x7666('0x2'));var BPromise=require(_0x7666('0x3'));var rs=require(_0x7666('0x4'));var fs=require('fs');var db=require(_0x7666('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7666('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7666('0x7')][_0x7666('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34b35d,_0x4dc65b,_0x318c34){return new BPromise(function(_0x2666e2,_0x28fb74){return client[_0x7666('0x9')](_0x34b35d,_0x318c34)[_0x7666('0xa')](function(_0x377a44){logger[_0x7666('0xb')](_0x7666('0xc'),_0x4dc65b,_0x7666('0xd'));logger['debug'](_0x7666('0xe'),_0x4dc65b,_0x7666('0xd'),JSON[_0x7666('0xf')](_0x377a44));if(_0x377a44['error']){if(_0x377a44[_0x7666('0x10')][_0x7666('0x11')]===0x1f4){logger[_0x7666('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x4dc65b,_0x377a44[_0x7666('0x10')]['message']);return _0x28fb74(_0x377a44[_0x7666('0x10')][_0x7666('0x12')]);}logger['error'](_0x7666('0xc'),_0x4dc65b,_0x377a44['error'][_0x7666('0x12')]);return _0x2666e2(_0x377a44[_0x7666('0x10')][_0x7666('0x12')]);}else{logger['info'](_0x7666('0xc'),_0x4dc65b,_0x7666('0xd'));_0x2666e2(_0x377a44[_0x7666('0x13')][_0x7666('0x12')]);}})['catch'](function(_0x498573){logger[_0x7666('0x10')](_0x7666('0xc'),_0x4dc65b,_0x498573);_0x28fb74(_0x498573);});});}exports['CreateCmHopperFinal']=function(_0x5c82ef){var _0x12da00=this;return new Promise(function(_0x4f292b,_0x399970){return db[_0x7666('0x14')][_0x7666('0x15')](_0x5c82ef[_0x7666('0x16')],{'raw':_0x5c82ef[_0x7666('0x17')]?_0x5c82ef[_0x7666('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7666('0xa')](function(_0x1300ff){logger[_0x7666('0xb')]('CreateCmHopperFinal',_0x5c82ef);logger['debug'](_0x7666('0x18'),_0x5c82ef,JSON[_0x7666('0xf')](_0x1300ff));_0x4f292b(_0x1300ff);})[_0x7666('0x19')](function(_0x2e9473){logger[_0x7666('0x10')](_0x7666('0x18'),_0x2e9473['message'],_0x5c82ef);_0x399970(_0x12da00[_0x7666('0x10')](0x1f4,_0x2e9473[_0x7666('0x12')]));});});};