Built motion from commit b4f7ded2.|2.0.69
[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 _0x524a=['code','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw','attributes','limit','debug','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x524a,0xf5));var _0xa524=function(_0x2b1f8d,_0x4bd60d){_0x2b1f8d=_0x2b1f8d-0x0;var _0x140d5a=_0x524a[_0x2b1f8d];return _0x140d5a;};'use strict';var _=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var moment=require(_0xa524('0x2'));var BPromise=require(_0xa524('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xa524('0x4'))['db'];var utils=require(_0xa524('0x5'));var logger=require(_0xa524('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa524('0x7'));var client=jayson[_0xa524('0x8')][_0xa524('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f472f,_0x460738,_0x56bd0e){return new BPromise(function(_0x3a2dd6,_0x11aa98){return client['request'](_0x5f472f,_0x56bd0e)[_0xa524('0xa')](function(_0x1db5bb){logger[_0xa524('0xb')](_0xa524('0xc'),_0x460738,_0xa524('0xd'));logger['debug'](_0xa524('0xe'),_0x460738,_0xa524('0xd'),JSON['stringify'](_0x1db5bb));if(_0x1db5bb['error']){if(_0x1db5bb[_0xa524('0xf')][_0xa524('0x10')]===0x1f4){logger[_0xa524('0xf')]('FaxApplication,\x20%s,\x20%s',_0x460738,_0x1db5bb['error'][_0xa524('0x11')]);return _0x11aa98(_0x1db5bb['error'][_0xa524('0x11')]);}logger['error'](_0xa524('0xc'),_0x460738,_0x1db5bb['error'][_0xa524('0x11')]);return _0x3a2dd6(_0x1db5bb[_0xa524('0xf')]['message']);}else{logger[_0xa524('0xb')](_0xa524('0xc'),_0x460738,_0xa524('0xd'));_0x3a2dd6(_0x1db5bb[_0xa524('0x12')][_0xa524('0x11')]);}})[_0xa524('0x13')](function(_0x371385){logger['error'](_0xa524('0xc'),_0x460738,_0x371385);_0x11aa98(_0x371385);});});}exports[_0xa524('0x14')]=function(_0x1fd8f5){var _0x3d6a0d=this;return new Promise(function(_0x375277,_0x805b93){return db[_0xa524('0x15')][_0xa524('0x16')](_0x1fd8f5['body'],{'raw':_0x1fd8f5[_0xa524('0x17')]?_0x1fd8f5[_0xa524('0x17')][_0xa524('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fd8f5[_0xa524('0x17')]?_0x1fd8f5['options']['where']||null:null,'attributes':_0x1fd8f5[_0xa524('0x17')]?_0x1fd8f5[_0xa524('0x17')][_0xa524('0x19')]||null:null,'limit':_0x1fd8f5[_0xa524('0x17')]?_0x1fd8f5[_0xa524('0x17')][_0xa524('0x1a')]||null:null})['then'](function(_0x262eac){logger[_0xa524('0xb')](_0xa524('0x14'),_0x1fd8f5);logger[_0xa524('0x1b')](_0xa524('0x14'),_0x1fd8f5,JSON[_0xa524('0x1c')](_0x262eac));_0x375277(_0x262eac);})[_0xa524('0x13')](function(_0x4babac){logger[_0xa524('0xf')](_0xa524('0x14'),_0x4babac['message'],_0x1fd8f5);_0x805b93(_0x3d6a0d['error'](0x1f4,_0x4babac[_0xa524('0x11')]));});});};