Built motion from commit 449495f6.|2.6.27
[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 _0x880e=['rpc','../../config/environment','jayson/promise','request','then','info','OpenchannelApplication,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3be8a4,_0x580c92){var _0x439efa=function(_0x333fb8){while(--_0x333fb8){_0x3be8a4['push'](_0x3be8a4['shift']());}};_0x439efa(++_0x580c92);}(_0x880e,0x9b));var _0xe880=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0x880e[_0x1d1963];return _0x3f58bb;};'use strict';var _=require(_0xe880('0x0'));var util=require(_0xe880('0x1'));var moment=require('moment');var BPromise=require(_0xe880('0x2'));var rs=require(_0xe880('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe880('0x4'))['db'];var utils=require(_0xe880('0x5'));var logger=require(_0xe880('0x6'))(_0xe880('0x7'));var config=require(_0xe880('0x8'));var jayson=require(_0xe880('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19dccb,_0x33fae3,_0x3b4d1f){return new BPromise(function(_0x4f1c4d,_0x168425){return client[_0xe880('0xa')](_0x19dccb,_0x3b4d1f)[_0xe880('0xb')](function(_0x4560f3){logger[_0xe880('0xc')](_0xe880('0xd'),_0x33fae3,'request\x20sent');logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x33fae3,'request\x20sent',JSON['stringify'](_0x4560f3));if(_0x4560f3[_0xe880('0xe')]){if(_0x4560f3[_0xe880('0xe')][_0xe880('0xf')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x33fae3,_0x4560f3[_0xe880('0xe')][_0xe880('0x10')]);return _0x168425(_0x4560f3[_0xe880('0xe')][_0xe880('0x10')]);}logger[_0xe880('0xe')](_0xe880('0xd'),_0x33fae3,_0x4560f3[_0xe880('0xe')][_0xe880('0x10')]);return _0x4f1c4d(_0x4560f3[_0xe880('0xe')][_0xe880('0x10')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x33fae3,_0xe880('0x11'));_0x4f1c4d(_0x4560f3[_0xe880('0x12')][_0xe880('0x10')]);}})[_0xe880('0x13')](function(_0x4b4721){logger[_0xe880('0xe')](_0xe880('0xd'),_0x33fae3,_0x4b4721);_0x168425(_0x4b4721);});});}exports[_0xe880('0x14')]=function(_0x4ffa88){var _0x5162f4=this;return new Promise(function(_0x4789de,_0x506a79){return db[_0xe880('0x15')][_0xe880('0x16')](_0x4ffa88['body'],{'raw':_0x4ffa88[_0xe880('0x17')]?_0x4ffa88[_0xe880('0x17')][_0xe880('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ffa88['options']?_0x4ffa88[_0xe880('0x17')][_0xe880('0x19')]||null:null,'attributes':_0x4ffa88[_0xe880('0x17')]?_0x4ffa88[_0xe880('0x17')]['attributes']||null:null,'limit':_0x4ffa88[_0xe880('0x17')]?_0x4ffa88[_0xe880('0x17')]['limit']||null:null})[_0xe880('0xb')](function(_0x5b6100){logger[_0xe880('0xc')](_0xe880('0x14'),_0x4ffa88);logger['debug']('UpdateOpenchannelApplication',_0x4ffa88,JSON[_0xe880('0x1a')](_0x5b6100));_0x4789de(_0x5b6100);})[_0xe880('0x13')](function(_0x3723be){logger[_0xe880('0xe')](_0xe880('0x14'),_0x3723be[_0xe880('0x10')],_0x4ffa88);_0x506a79(_0x5162f4['error'](0x1f4,_0x3723be[_0xe880('0x10')]));});});};