Built motion from commit (unavailable).|2.2.2
[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 _0xc392=['request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','limit','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1e5cc3,_0x238a87){var _0x15c596=function(_0x27bb04){while(--_0x27bb04){_0x1e5cc3['push'](_0x1e5cc3['shift']());}};_0x15c596(++_0x238a87);}(_0xc392,0x13b));var _0x2c39=function(_0x1b13c3,_0x2368ac){_0x1b13c3=_0x1b13c3-0x0;var _0x15e8dc=_0xc392[_0x1b13c3];return _0x15e8dc;};'use strict';var _=require('lodash');var util=require(_0x2c39('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c39('0x1'));var db=require(_0x2c39('0x2'))['db'];var utils=require(_0x2c39('0x3'));var logger=require(_0x2c39('0x4'))(_0x2c39('0x5'));var config=require(_0x2c39('0x6'));var jayson=require(_0x2c39('0x7'));var client=jayson['client'][_0x2c39('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ee9d5,_0x19f4db,_0x509ec8){return new BPromise(function(_0x45c56f,_0x19dd38){return client[_0x2c39('0x9')](_0x5ee9d5,_0x509ec8)[_0x2c39('0xa')](function(_0x2b8e88){logger[_0x2c39('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x19f4db,_0x2c39('0xc'));logger[_0x2c39('0xd')](_0x2c39('0xe'),_0x19f4db,_0x2c39('0xc'),JSON[_0x2c39('0xf')](_0x2b8e88));if(_0x2b8e88[_0x2c39('0x10')]){if(_0x2b8e88[_0x2c39('0x10')][_0x2c39('0x11')]===0x1f4){logger[_0x2c39('0x10')](_0x2c39('0x12'),_0x19f4db,_0x2b8e88['error'][_0x2c39('0x13')]);return _0x19dd38(_0x2b8e88[_0x2c39('0x10')][_0x2c39('0x13')]);}logger[_0x2c39('0x10')](_0x2c39('0x12'),_0x19f4db,_0x2b8e88['error']['message']);return _0x45c56f(_0x2b8e88['error'][_0x2c39('0x13')]);}else{logger['info'](_0x2c39('0x12'),_0x19f4db,'request\x20sent');_0x45c56f(_0x2b8e88[_0x2c39('0x14')]['message']);}})[_0x2c39('0x15')](function(_0x8b7d15){logger[_0x2c39('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x19f4db,_0x8b7d15);_0x19dd38(_0x8b7d15);});});}exports[_0x2c39('0x16')]=function(_0x5b0764){var _0x1646c1=this;return new Promise(function(_0x3cb8d6,_0x1db426){return db[_0x2c39('0x17')]['update'](_0x5b0764[_0x2c39('0x18')],{'raw':_0x5b0764[_0x2c39('0x19')]?_0x5b0764['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b0764['options']?_0x5b0764[_0x2c39('0x19')]['where']||null:null,'attributes':_0x5b0764['options']?_0x5b0764[_0x2c39('0x19')]['attributes']||null:null,'limit':_0x5b0764['options']?_0x5b0764[_0x2c39('0x19')][_0x2c39('0x1a')]||null:null})[_0x2c39('0xa')](function(_0x3d7cb5){logger['info'](_0x2c39('0x16'),_0x5b0764);logger[_0x2c39('0xd')](_0x2c39('0x16'),_0x5b0764,JSON[_0x2c39('0xf')](_0x3d7cb5));_0x3cb8d6(_0x3d7cb5);})[_0x2c39('0x15')](function(_0x69ce1a){logger[_0x2c39('0x10')](_0x2c39('0x16'),_0x69ce1a[_0x2c39('0x13')],_0x5b0764);_0x1db426(_0x1646c1[_0x2c39('0x10')](0x1f4,_0x69ce1a[_0x2c39('0x13')]));});});};