77a2f9eaf6dcf22697ca1abd4317a120cf5a6d00
[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 _0x1855=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','limit','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x34e85e,_0x5b8ca2){var _0x3e5347=function(_0x34a58d){while(--_0x34a58d){_0x34e85e['push'](_0x34e85e['shift']());}};_0x3e5347(++_0x5b8ca2);}(_0x1855,0x19a));var _0x5185=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x1855[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x5185('0x0'));var util=require(_0x5185('0x1'));var moment=require(_0x5185('0x2'));var BPromise=require(_0x5185('0x3'));var rs=require(_0x5185('0x4'));var fs=require('fs');var Redis=require(_0x5185('0x5'));var db=require(_0x5185('0x6'))['db'];var utils=require(_0x5185('0x7'));var logger=require('../../config/logger')(_0x5185('0x8'));var config=require('../../config/environment');var jayson=require(_0x5185('0x9'));var client=jayson[_0x5185('0xa')][_0x5185('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x243e9e,_0x13e2f0,_0x3a8b46){return new BPromise(function(_0x408d63,_0x16e0eb){return client[_0x5185('0xc')](_0x243e9e,_0x3a8b46)[_0x5185('0xd')](function(_0x11feb2){logger[_0x5185('0xe')](_0x5185('0xf'),_0x13e2f0,_0x5185('0x10'));logger['debug'](_0x5185('0x11'),_0x13e2f0,_0x5185('0x10'),JSON['stringify'](_0x11feb2));if(_0x11feb2[_0x5185('0x12')]){if(_0x11feb2[_0x5185('0x12')]['code']===0x1f4){logger[_0x5185('0x12')]('FaxApplication,\x20%s,\x20%s',_0x13e2f0,_0x11feb2[_0x5185('0x12')][_0x5185('0x13')]);return _0x16e0eb(_0x11feb2[_0x5185('0x12')]['message']);}logger[_0x5185('0x12')]('FaxApplication,\x20%s,\x20%s',_0x13e2f0,_0x11feb2[_0x5185('0x12')][_0x5185('0x13')]);return _0x408d63(_0x11feb2[_0x5185('0x12')][_0x5185('0x13')]);}else{logger[_0x5185('0xe')]('FaxApplication,\x20%s,\x20%s',_0x13e2f0,_0x5185('0x10'));_0x408d63(_0x11feb2[_0x5185('0x14')][_0x5185('0x13')]);}})[_0x5185('0x15')](function(_0x1c034c){logger[_0x5185('0x12')]('FaxApplication,\x20%s,\x20%s',_0x13e2f0,_0x1c034c);_0x16e0eb(_0x1c034c);});});}exports[_0x5185('0x16')]=function(_0xc4ae31){var _0x818255=this;return new Promise(function(_0x187f8a,_0x265f3c){return db[_0x5185('0x17')][_0x5185('0x18')](_0xc4ae31[_0x5185('0x19')],{'raw':_0xc4ae31[_0x5185('0x1a')]?_0xc4ae31[_0x5185('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc4ae31[_0x5185('0x1a')]?_0xc4ae31[_0x5185('0x1a')][_0x5185('0x1b')]||null:null,'attributes':_0xc4ae31[_0x5185('0x1a')]?_0xc4ae31['options'][_0x5185('0x1c')]||null:null,'limit':_0xc4ae31[_0x5185('0x1a')]?_0xc4ae31[_0x5185('0x1a')][_0x5185('0x1d')]||null:null})['then'](function(_0x56b726){logger[_0x5185('0xe')](_0x5185('0x16'),_0xc4ae31);logger[_0x5185('0x1e')](_0x5185('0x16'),_0xc4ae31,JSON[_0x5185('0x1f')](_0x56b726));_0x187f8a(_0x56b726);})[_0x5185('0x15')](function(_0x59f339){logger[_0x5185('0x12')]('UpdateFaxApplication',_0x59f339[_0x5185('0x13')],_0xc4ae31);_0x265f3c(_0x818255[_0x5185('0x12')](0x1f4,_0x59f339[_0x5185('0x13')]));});});};