Built motion from commit (unavailable).|2.1.0
[motion2.git] / server / api / faxApplication / faxApplication.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 _0x9f27=['raw','options','where','attributes','limit','then','info','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateFaxApplication','FaxApplication','update','body'];(function(_0x22cd0c,_0x4040b6){var _0x439eba=function(_0x43c4a0){while(--_0x43c4a0){_0x22cd0c['push'](_0x22cd0c['shift']());}};_0x439eba(++_0x4040b6);}(_0x9f27,0xc8));var _0x79f2=function(_0x5de095,_0x34cd53){_0x5de095=_0x5de095-0x0;var _0x2613f7=_0x9f27[_0x5de095];return _0x2613f7;};'use strict';var _=require('lodash');var util=require(_0x79f2('0x0'));var moment=require(_0x79f2('0x1'));var BPromise=require(_0x79f2('0x2'));var rs=require(_0x79f2('0x3'));var fs=require('fs');var Redis=require(_0x79f2('0x4'));var db=require(_0x79f2('0x5'))['db'];var utils=require(_0x79f2('0x6'));var logger=require(_0x79f2('0x7'))(_0x79f2('0x8'));var config=require(_0x79f2('0x9'));var jayson=require(_0x79f2('0xa'));var client=jayson['client'][_0x79f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x506516,_0x369ba7,_0x520530){return new BPromise(function(_0x130a21,_0x3d88d5){return client['request'](_0x506516,_0x520530)['then'](function(_0x17a84c){logger['info'](_0x79f2('0xc'),_0x369ba7,_0x79f2('0xd'));logger['debug'](_0x79f2('0xe'),_0x369ba7,_0x79f2('0xd'),JSON[_0x79f2('0xf')](_0x17a84c));if(_0x17a84c[_0x79f2('0x10')]){if(_0x17a84c[_0x79f2('0x10')][_0x79f2('0x11')]===0x1f4){logger[_0x79f2('0x10')]('FaxApplication,\x20%s,\x20%s',_0x369ba7,_0x17a84c[_0x79f2('0x10')][_0x79f2('0x12')]);return _0x3d88d5(_0x17a84c['error']['message']);}logger[_0x79f2('0x10')](_0x79f2('0xc'),_0x369ba7,_0x17a84c[_0x79f2('0x10')][_0x79f2('0x12')]);return _0x130a21(_0x17a84c[_0x79f2('0x10')][_0x79f2('0x12')]);}else{logger['info'](_0x79f2('0xc'),_0x369ba7,_0x79f2('0xd'));_0x130a21(_0x17a84c['result']['message']);}})[_0x79f2('0x13')](function(_0x56f897){logger[_0x79f2('0x10')](_0x79f2('0xc'),_0x369ba7,_0x56f897);_0x3d88d5(_0x56f897);});});}exports[_0x79f2('0x14')]=function(_0x166b09){var _0x32e596=this;return new Promise(function(_0x364953,_0x3074f4){return db[_0x79f2('0x15')][_0x79f2('0x16')](_0x166b09[_0x79f2('0x17')],{'raw':_0x166b09['options']?_0x166b09['options'][_0x79f2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x166b09[_0x79f2('0x19')]?_0x166b09[_0x79f2('0x19')][_0x79f2('0x1a')]||null:null,'attributes':_0x166b09[_0x79f2('0x19')]?_0x166b09['options'][_0x79f2('0x1b')]||null:null,'limit':_0x166b09[_0x79f2('0x19')]?_0x166b09[_0x79f2('0x19')][_0x79f2('0x1c')]||null:null})[_0x79f2('0x1d')](function(_0x2a05fe){logger[_0x79f2('0x1e')](_0x79f2('0x14'),_0x166b09);logger[_0x79f2('0x1f')](_0x79f2('0x14'),_0x166b09,JSON[_0x79f2('0xf')](_0x2a05fe));_0x364953(_0x2a05fe);})[_0x79f2('0x13')](function(_0x1526ed){logger['error'](_0x79f2('0x14'),_0x1526ed[_0x79f2('0x12')],_0x166b09);_0x3074f4(_0x32e596[_0x79f2('0x10')](0x1f4,_0x1526ed[_0x79f2('0x12')]));});});};