Built motion from commit fe909640.|2.6.8
[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 _0x6250=['request','then','request\x20sent','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','body','options','raw','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x184461,_0x2011f7){var _0x52f443=function(_0x176d92){while(--_0x176d92){_0x184461['push'](_0x184461['shift']());}};_0x52f443(++_0x2011f7);}(_0x6250,0x18a));var _0x0625=function(_0x34ce8a,_0x2764f5){_0x34ce8a=_0x34ce8a-0x0;var _0x3dcae5=_0x6250[_0x34ce8a];return _0x3dcae5;};'use strict';var _=require(_0x0625('0x0'));var util=require(_0x0625('0x1'));var moment=require(_0x0625('0x2'));var BPromise=require(_0x0625('0x3'));var rs=require(_0x0625('0x4'));var fs=require('fs');var Redis=require(_0x0625('0x5'));var db=require(_0x0625('0x6'))['db'];var utils=require(_0x0625('0x7'));var logger=require('../../config/logger')(_0x0625('0x8'));var config=require(_0x0625('0x9'));var jayson=require(_0x0625('0xa'));var client=jayson[_0x0625('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27c35a,_0x592a46,_0x227d3e){return new BPromise(function(_0xeb58c7,_0x10bf7e){return client[_0x0625('0xc')](_0x27c35a,_0x227d3e)[_0x0625('0xd')](function(_0x283cb4){logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x592a46,_0x0625('0xe'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x592a46,'request\x20sent',JSON['stringify'](_0x283cb4));if(_0x283cb4[_0x0625('0xf')]){if(_0x283cb4[_0x0625('0xf')][_0x0625('0x10')]===0x1f4){logger[_0x0625('0xf')](_0x0625('0x11'),_0x592a46,_0x283cb4['error'][_0x0625('0x12')]);return _0x10bf7e(_0x283cb4[_0x0625('0xf')][_0x0625('0x12')]);}logger[_0x0625('0xf')](_0x0625('0x11'),_0x592a46,_0x283cb4[_0x0625('0xf')][_0x0625('0x12')]);return _0xeb58c7(_0x283cb4['error'][_0x0625('0x12')]);}else{logger['info'](_0x0625('0x11'),_0x592a46,_0x0625('0xe'));_0xeb58c7(_0x283cb4[_0x0625('0x13')][_0x0625('0x12')]);}})[_0x0625('0x14')](function(_0x4dcd8d){logger[_0x0625('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x592a46,_0x4dcd8d);_0x10bf7e(_0x4dcd8d);});});}exports[_0x0625('0x15')]=function(_0x331248){var _0x33c3fc=this;return new Promise(function(_0x1d8318,_0x10e5b5){return db['OpenchannelApplication']['update'](_0x331248[_0x0625('0x16')],{'raw':_0x331248[_0x0625('0x17')]?_0x331248[_0x0625('0x17')][_0x0625('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x331248[_0x0625('0x17')]?_0x331248[_0x0625('0x17')][_0x0625('0x19')]||null:null,'attributes':_0x331248[_0x0625('0x17')]?_0x331248[_0x0625('0x17')][_0x0625('0x1a')]||null:null,'limit':_0x331248[_0x0625('0x17')]?_0x331248[_0x0625('0x17')][_0x0625('0x1b')]||null:null})[_0x0625('0xd')](function(_0x3804ed){logger['info']('UpdateOpenchannelApplication',_0x331248);logger['debug']('UpdateOpenchannelApplication',_0x331248,JSON[_0x0625('0x1c')](_0x3804ed));_0x1d8318(_0x3804ed);})['catch'](function(_0xd226cf){logger[_0x0625('0xf')](_0x0625('0x15'),_0xd226cf[_0x0625('0x12')],_0x331248);_0x10e5b5(_0x33c3fc[_0x0625('0xf')](0x1f4,_0xd226cf[_0x0625('0x12')]));});});};