Built motion from commit (unavailable).|2.5.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 _0xff1f=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxApplication','body','raw','options','attributes','UpdateFaxApplication','catch','lodash','util'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xff1f,0xd0));var _0xfff1=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0xff1f[_0x53fe97];return _0x5c49a2;};'use strict';var _=require(_0xfff1('0x0'));var util=require(_0xfff1('0x1'));var moment=require(_0xfff1('0x2'));var BPromise=require('bluebird');var rs=require(_0xfff1('0x3'));var fs=require('fs');var Redis=require(_0xfff1('0x4'));var db=require(_0xfff1('0x5'))['db'];var utils=require(_0xfff1('0x6'));var logger=require(_0xfff1('0x7'))(_0xfff1('0x8'));var config=require('../../config/environment');var jayson=require(_0xfff1('0x9'));var client=jayson[_0xfff1('0xa')][_0xfff1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xed3d34,_0x15c012,_0x1b2bbc){return new BPromise(function(_0x51190d,_0x1b6f24){return client[_0xfff1('0xc')](_0xed3d34,_0x1b2bbc)[_0xfff1('0xd')](function(_0xce0b8d){logger[_0xfff1('0xe')](_0xfff1('0xf'),_0x15c012,'request\x20sent');logger[_0xfff1('0x10')](_0xfff1('0x11'),_0x15c012,_0xfff1('0x12'),JSON[_0xfff1('0x13')](_0xce0b8d));if(_0xce0b8d[_0xfff1('0x14')]){if(_0xce0b8d[_0xfff1('0x14')][_0xfff1('0x15')]===0x1f4){logger[_0xfff1('0x14')](_0xfff1('0xf'),_0x15c012,_0xce0b8d[_0xfff1('0x14')][_0xfff1('0x16')]);return _0x1b6f24(_0xce0b8d['error'][_0xfff1('0x16')]);}logger[_0xfff1('0x14')](_0xfff1('0xf'),_0x15c012,_0xce0b8d[_0xfff1('0x14')]['message']);return _0x51190d(_0xce0b8d[_0xfff1('0x14')][_0xfff1('0x16')]);}else{logger[_0xfff1('0xe')](_0xfff1('0xf'),_0x15c012,'request\x20sent');_0x51190d(_0xce0b8d['result'][_0xfff1('0x16')]);}})['catch'](function(_0x1187d1){logger[_0xfff1('0x14')]('FaxApplication,\x20%s,\x20%s',_0x15c012,_0x1187d1);_0x1b6f24(_0x1187d1);});});}exports['UpdateFaxApplication']=function(_0x477cc5){var _0x2e7667=this;return new Promise(function(_0x342500,_0x86db6){return db[_0xfff1('0x17')]['update'](_0x477cc5[_0xfff1('0x18')],{'raw':_0x477cc5['options']?_0x477cc5['options'][_0xfff1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x477cc5[_0xfff1('0x1a')]?_0x477cc5[_0xfff1('0x1a')]['where']||null:null,'attributes':_0x477cc5['options']?_0x477cc5[_0xfff1('0x1a')][_0xfff1('0x1b')]||null:null,'limit':_0x477cc5[_0xfff1('0x1a')]?_0x477cc5[_0xfff1('0x1a')]['limit']||null:null})['then'](function(_0x1c318c){logger[_0xfff1('0xe')](_0xfff1('0x1c'),_0x477cc5);logger[_0xfff1('0x10')](_0xfff1('0x1c'),_0x477cc5,JSON[_0xfff1('0x13')](_0x1c318c));_0x342500(_0x1c318c);})[_0xfff1('0x1d')](function(_0xb5b4a7){logger[_0xfff1('0x14')](_0xfff1('0x1c'),_0xb5b4a7['message'],_0x477cc5);_0x86db6(_0x2e7667['error'](0x1f4,_0xb5b4a7[_0xfff1('0x16')]));});});};