Built motion from commit d1eab355.|2.6.28
[motion2.git] / server / api / openchannelApplication / openchannelApplication.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 _0x9397=['then','info','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','OpenchannelApplication,\x20%s,\x20%s','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','where','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x25a597,_0xa4ae6d){var _0x2a5eb4=function(_0x3e36cb){while(--_0x3e36cb){_0x25a597['push'](_0x25a597['shift']());}};_0x2a5eb4(++_0xa4ae6d);}(_0x9397,0x84));var _0x7939=function(_0x15f8c6,_0x1e62bd){_0x15f8c6=_0x15f8c6-0x0;var _0x4c28ef=_0x9397[_0x15f8c6];return _0x4c28ef;};'use strict';var _=require(_0x7939('0x0'));var util=require(_0x7939('0x1'));var moment=require('moment');var BPromise=require(_0x7939('0x2'));var rs=require(_0x7939('0x3'));var fs=require('fs');var Redis=require(_0x7939('0x4'));var db=require(_0x7939('0x5'))['db'];var utils=require(_0x7939('0x6'));var logger=require(_0x7939('0x7'))(_0x7939('0x8'));var config=require(_0x7939('0x9'));var jayson=require(_0x7939('0xa'));var client=jayson['client'][_0x7939('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f7cc6,_0xef2e2d,_0x4166da){return new BPromise(function(_0x2abaf1,_0x2ff856){return client[_0x7939('0xc')](_0x2f7cc6,_0x4166da)[_0x7939('0xd')](function(_0x27c280){logger[_0x7939('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0xef2e2d,_0x7939('0xf'));logger['debug'](_0x7939('0x10'),_0xef2e2d,_0x7939('0xf'),JSON[_0x7939('0x11')](_0x27c280));if(_0x27c280['error']){if(_0x27c280['error'][_0x7939('0x12')]===0x1f4){logger[_0x7939('0x13')](_0x7939('0x14'),_0xef2e2d,_0x27c280[_0x7939('0x13')][_0x7939('0x15')]);return _0x2ff856(_0x27c280['error']['message']);}logger[_0x7939('0x13')](_0x7939('0x14'),_0xef2e2d,_0x27c280[_0x7939('0x13')]['message']);return _0x2abaf1(_0x27c280[_0x7939('0x13')][_0x7939('0x15')]);}else{logger[_0x7939('0xe')](_0x7939('0x14'),_0xef2e2d,'request\x20sent');_0x2abaf1(_0x27c280['result'][_0x7939('0x15')]);}})[_0x7939('0x16')](function(_0x19bf05){logger[_0x7939('0x13')](_0x7939('0x14'),_0xef2e2d,_0x19bf05);_0x2ff856(_0x19bf05);});});}exports[_0x7939('0x17')]=function(_0x4e35ee){var _0x5a1f3e=this;return new Promise(function(_0x52e7c8,_0x11af62){return db[_0x7939('0x18')][_0x7939('0x19')](_0x4e35ee['body'],{'raw':_0x4e35ee['options']?_0x4e35ee[_0x7939('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e35ee['options']?_0x4e35ee['options'][_0x7939('0x1b')]||null:null,'attributes':_0x4e35ee[_0x7939('0x1a')]?_0x4e35ee[_0x7939('0x1a')]['attributes']||null:null,'limit':_0x4e35ee[_0x7939('0x1a')]?_0x4e35ee[_0x7939('0x1a')]['limit']||null:null})[_0x7939('0xd')](function(_0x202b3e){logger[_0x7939('0xe')](_0x7939('0x17'),_0x4e35ee);logger[_0x7939('0x1c')]('UpdateOpenchannelApplication',_0x4e35ee,JSON['stringify'](_0x202b3e));_0x52e7c8(_0x202b3e);})[_0x7939('0x16')](function(_0x45995b){logger['error']('UpdateOpenchannelApplication',_0x45995b[_0x7939('0x15')],_0x4e35ee);_0x11af62(_0x5a1f3e[_0x7939('0x13')](0x1f4,_0x45995b[_0x7939('0x15')]));});});};