Built motion from commit 0c5f406c.|2.6.29
[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 _0x5570=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','limit'];(function(_0x495f2b,_0x253ab3){var _0x12fa6e=function(_0xbb4b3b){while(--_0xbb4b3b){_0x495f2b['push'](_0x495f2b['shift']());}};_0x12fa6e(++_0x253ab3);}(_0x5570,0x122));var _0x0557=function(_0x118d39,_0x43be87){_0x118d39=_0x118d39-0x0;var _0x47958b=_0x5570[_0x118d39];return _0x47958b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0557('0x0'));var BPromise=require(_0x0557('0x1'));var rs=require(_0x0557('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0557('0x3'))['db'];var utils=require(_0x0557('0x4'));var logger=require('../../config/logger')(_0x0557('0x5'));var config=require(_0x0557('0x6'));var jayson=require(_0x0557('0x7'));var client=jayson[_0x0557('0x8')][_0x0557('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17bd51,_0x168641,_0x3afc9d){return new BPromise(function(_0x13b56e,_0x28a84a){return client['request'](_0x17bd51,_0x3afc9d)[_0x0557('0xa')](function(_0x50e0e9){logger[_0x0557('0xb')](_0x0557('0xc'),_0x168641,'request\x20sent');logger[_0x0557('0xd')](_0x0557('0xe'),_0x168641,_0x0557('0xf'),JSON[_0x0557('0x10')](_0x50e0e9));if(_0x50e0e9[_0x0557('0x11')]){if(_0x50e0e9[_0x0557('0x11')][_0x0557('0x12')]===0x1f4){logger[_0x0557('0x11')]('FaxApplication,\x20%s,\x20%s',_0x168641,_0x50e0e9[_0x0557('0x11')][_0x0557('0x13')]);return _0x28a84a(_0x50e0e9[_0x0557('0x11')]['message']);}logger[_0x0557('0x11')](_0x0557('0xc'),_0x168641,_0x50e0e9[_0x0557('0x11')][_0x0557('0x13')]);return _0x13b56e(_0x50e0e9[_0x0557('0x11')]['message']);}else{logger[_0x0557('0xb')]('FaxApplication,\x20%s,\x20%s',_0x168641,_0x0557('0xf'));_0x13b56e(_0x50e0e9[_0x0557('0x14')][_0x0557('0x13')]);}})[_0x0557('0x15')](function(_0xdc727a){logger['error'](_0x0557('0xc'),_0x168641,_0xdc727a);_0x28a84a(_0xdc727a);});});}exports[_0x0557('0x16')]=function(_0x2dff77){var _0x24c4ec=this;return new Promise(function(_0x5a1e34,_0xfb871){return db[_0x0557('0x17')][_0x0557('0x18')](_0x2dff77[_0x0557('0x19')],{'raw':_0x2dff77[_0x0557('0x1a')]?_0x2dff77[_0x0557('0x1a')][_0x0557('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dff77[_0x0557('0x1a')]?_0x2dff77[_0x0557('0x1a')]['where']||null:null,'attributes':_0x2dff77[_0x0557('0x1a')]?_0x2dff77[_0x0557('0x1a')]['attributes']||null:null,'limit':_0x2dff77[_0x0557('0x1a')]?_0x2dff77['options'][_0x0557('0x1c')]||null:null})['then'](function(_0x4b1290){logger[_0x0557('0xb')](_0x0557('0x16'),_0x2dff77);logger[_0x0557('0xd')](_0x0557('0x16'),_0x2dff77,JSON[_0x0557('0x10')](_0x4b1290));_0x5a1e34(_0x4b1290);})[_0x0557('0x15')](function(_0x4ee9f9){logger[_0x0557('0x11')]('UpdateFaxApplication',_0x4ee9f9['message'],_0x2dff77);_0xfb871(_0x24c4ec[_0x0557('0x11')](0x1f4,_0x4ee9f9[_0x0557('0x13')]));});});};