Built motion from commit 5293bb2a.|2.6.30
[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 _0x3883=['options','raw','where','attributes','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','catch','UpdateOpenchannelApplication','OpenchannelApplication'];(function(_0xe6d067,_0x5af043){var _0x213c54=function(_0x32e860){while(--_0x32e860){_0xe6d067['push'](_0xe6d067['shift']());}};_0x213c54(++_0x5af043);}(_0x3883,0x19a));var _0x3388=function(_0x773b6d,_0x15b9b4){_0x773b6d=_0x773b6d-0x0;var _0x2d4e3b=_0x3883[_0x773b6d];return _0x2d4e3b;};'use strict';var _=require(_0x3388('0x0'));var util=require(_0x3388('0x1'));var moment=require(_0x3388('0x2'));var BPromise=require(_0x3388('0x3'));var rs=require(_0x3388('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3388('0x5'));var logger=require(_0x3388('0x6'))(_0x3388('0x7'));var config=require(_0x3388('0x8'));var jayson=require(_0x3388('0x9'));var client=jayson[_0x3388('0xa')][_0x3388('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xae7ad6,_0x278538,_0x1a6ee){return new BPromise(function(_0x420cb0,_0x2df31a){return client[_0x3388('0xc')](_0xae7ad6,_0x1a6ee)[_0x3388('0xd')](function(_0x30f79b){logger[_0x3388('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x278538,_0x3388('0xf'));logger[_0x3388('0x10')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x278538,_0x3388('0xf'),JSON[_0x3388('0x11')](_0x30f79b));if(_0x30f79b['error']){if(_0x30f79b[_0x3388('0x12')][_0x3388('0x13')]===0x1f4){logger[_0x3388('0x12')](_0x3388('0x14'),_0x278538,_0x30f79b[_0x3388('0x12')][_0x3388('0x15')]);return _0x2df31a(_0x30f79b[_0x3388('0x12')][_0x3388('0x15')]);}logger[_0x3388('0x12')](_0x3388('0x14'),_0x278538,_0x30f79b[_0x3388('0x12')][_0x3388('0x15')]);return _0x420cb0(_0x30f79b[_0x3388('0x12')]['message']);}else{logger[_0x3388('0xe')](_0x3388('0x14'),_0x278538,_0x3388('0xf'));_0x420cb0(_0x30f79b['result'][_0x3388('0x15')]);}})[_0x3388('0x16')](function(_0x1af64d){logger[_0x3388('0x12')](_0x3388('0x14'),_0x278538,_0x1af64d);_0x2df31a(_0x1af64d);});});}exports[_0x3388('0x17')]=function(_0x28838b){var _0x19e334=this;return new Promise(function(_0x1a6cd9,_0x5b7d1c){return db[_0x3388('0x18')]['update'](_0x28838b['body'],{'raw':_0x28838b[_0x3388('0x19')]?_0x28838b[_0x3388('0x19')][_0x3388('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28838b['options']?_0x28838b['options'][_0x3388('0x1b')]||null:null,'attributes':_0x28838b['options']?_0x28838b['options'][_0x3388('0x1c')]||null:null,'limit':_0x28838b[_0x3388('0x19')]?_0x28838b['options']['limit']||null:null})[_0x3388('0xd')](function(_0x578ccc){logger[_0x3388('0xe')]('UpdateOpenchannelApplication',_0x28838b);logger['debug']('UpdateOpenchannelApplication',_0x28838b,JSON[_0x3388('0x11')](_0x578ccc));_0x1a6cd9(_0x578ccc);})['catch'](function(_0x57e103){logger['error'](_0x3388('0x17'),_0x57e103[_0x3388('0x15')],_0x28838b);_0x5b7d1c(_0x19e334[_0x3388('0x12')](0x1f4,_0x57e103['message']));});});};