Built motion from commit e8da49ee.|2.6.33
[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 _0xe93b=['limit','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','FaxApplication,\x20%s,\x20%s','message','info','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where'];(function(_0x29a29f,_0x155ce7){var _0x443ea3=function(_0xe0dd24){while(--_0xe0dd24){_0x29a29f['push'](_0x29a29f['shift']());}};_0x443ea3(++_0x155ce7);}(_0xe93b,0x16a));var _0xbe93=function(_0x47dc5d,_0x1c1055){_0x47dc5d=_0x47dc5d-0x0;var _0x120c38=_0xe93b[_0x47dc5d];return _0x120c38;};'use strict';var _=require(_0xbe93('0x0'));var util=require(_0xbe93('0x1'));var moment=require(_0xbe93('0x2'));var BPromise=require(_0xbe93('0x3'));var rs=require(_0xbe93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbe93('0x5'));var logger=require(_0xbe93('0x6'))(_0xbe93('0x7'));var config=require(_0xbe93('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbe93('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dd8aa,_0x2d5f9a,_0x3ab63c){return new BPromise(function(_0x396b8c,_0x1edee5){return client[_0xbe93('0xa')](_0x2dd8aa,_0x3ab63c)[_0xbe93('0xb')](function(_0x35ac7f){logger['info']('FaxApplication,\x20%s,\x20%s',_0x2d5f9a,_0xbe93('0xc'));logger[_0xbe93('0xd')](_0xbe93('0xe'),_0x2d5f9a,_0xbe93('0xc'),JSON['stringify'](_0x35ac7f));if(_0x35ac7f[_0xbe93('0xf')]){if(_0x35ac7f[_0xbe93('0xf')][_0xbe93('0x10')]===0x1f4){logger[_0xbe93('0xf')](_0xbe93('0x11'),_0x2d5f9a,_0x35ac7f[_0xbe93('0xf')]['message']);return _0x1edee5(_0x35ac7f['error'][_0xbe93('0x12')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x2d5f9a,_0x35ac7f[_0xbe93('0xf')]['message']);return _0x396b8c(_0x35ac7f['error'][_0xbe93('0x12')]);}else{logger[_0xbe93('0x13')](_0xbe93('0x11'),_0x2d5f9a,_0xbe93('0xc'));_0x396b8c(_0x35ac7f[_0xbe93('0x14')][_0xbe93('0x12')]);}})[_0xbe93('0x15')](function(_0x4c159d){logger[_0xbe93('0xf')](_0xbe93('0x11'),_0x2d5f9a,_0x4c159d);_0x1edee5(_0x4c159d);});});}exports[_0xbe93('0x16')]=function(_0x473c98){var _0x45ca1d=this;return new Promise(function(_0xd79b70,_0xcf665d){return db[_0xbe93('0x17')][_0xbe93('0x18')](_0x473c98[_0xbe93('0x19')],{'raw':_0x473c98[_0xbe93('0x1a')]?_0x473c98[_0xbe93('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x473c98[_0xbe93('0x1a')]?_0x473c98[_0xbe93('0x1a')][_0xbe93('0x1b')]||null:null,'attributes':_0x473c98[_0xbe93('0x1a')]?_0x473c98[_0xbe93('0x1a')]['attributes']||null:null,'limit':_0x473c98[_0xbe93('0x1a')]?_0x473c98['options'][_0xbe93('0x1c')]||null:null})[_0xbe93('0xb')](function(_0x5233c7){logger[_0xbe93('0x13')](_0xbe93('0x16'),_0x473c98);logger[_0xbe93('0xd')]('UpdateFaxApplication',_0x473c98,JSON[_0xbe93('0x1d')](_0x5233c7));_0xd79b70(_0x5233c7);})['catch'](function(_0x37178f){logger['error'](_0xbe93('0x16'),_0x37178f['message'],_0x473c98);_0xcf665d(_0x45ca1d[_0xbe93('0xf')](0x1f4,_0x37178f[_0xbe93('0x12')]));});});};