Built motion from commit b0a9a629.|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 _0x3cde=['body','options','raw','where','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateFaxApplication','FaxApplication','update'];(function(_0x13659a,_0x41453c){var _0x4b1c49=function(_0x270c47){while(--_0x270c47){_0x13659a['push'](_0x13659a['shift']());}};_0x4b1c49(++_0x41453c);}(_0x3cde,0x1cf));var _0xe3cd=function(_0x1e0511,_0x57b46f){_0x1e0511=_0x1e0511-0x0;var _0x14f454=_0x3cde[_0x1e0511];return _0x14f454;};'use strict';var _=require(_0xe3cd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe3cd('0x1'));var rs=require(_0xe3cd('0x2'));var fs=require('fs');var Redis=require(_0xe3cd('0x3'));var db=require(_0xe3cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe3cd('0x5'));var jayson=require(_0xe3cd('0x6'));var client=jayson[_0xe3cd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x468492,_0x45c2e5,_0x13c386){return new BPromise(function(_0x27ca98,_0x26e16f){return client[_0xe3cd('0x8')](_0x468492,_0x13c386)[_0xe3cd('0x9')](function(_0x1e448a){logger['info'](_0xe3cd('0xa'),_0x45c2e5,_0xe3cd('0xb'));logger[_0xe3cd('0xc')](_0xe3cd('0xd'),_0x45c2e5,_0xe3cd('0xb'),JSON['stringify'](_0x1e448a));if(_0x1e448a['error']){if(_0x1e448a[_0xe3cd('0xe')][_0xe3cd('0xf')]===0x1f4){logger[_0xe3cd('0xe')](_0xe3cd('0xa'),_0x45c2e5,_0x1e448a[_0xe3cd('0xe')]['message']);return _0x26e16f(_0x1e448a[_0xe3cd('0xe')][_0xe3cd('0x10')]);}logger[_0xe3cd('0xe')](_0xe3cd('0xa'),_0x45c2e5,_0x1e448a[_0xe3cd('0xe')][_0xe3cd('0x10')]);return _0x27ca98(_0x1e448a[_0xe3cd('0xe')]['message']);}else{logger[_0xe3cd('0x11')](_0xe3cd('0xa'),_0x45c2e5,_0xe3cd('0xb'));_0x27ca98(_0x1e448a[_0xe3cd('0x12')][_0xe3cd('0x10')]);}})[_0xe3cd('0x13')](function(_0x3641d7){logger['error'](_0xe3cd('0xa'),_0x45c2e5,_0x3641d7);_0x26e16f(_0x3641d7);});});}exports[_0xe3cd('0x14')]=function(_0x21ea21){var _0x498bc4=this;return new Promise(function(_0x414780,_0x4a16ca){return db[_0xe3cd('0x15')][_0xe3cd('0x16')](_0x21ea21[_0xe3cd('0x17')],{'raw':_0x21ea21[_0xe3cd('0x18')]?_0x21ea21[_0xe3cd('0x18')][_0xe3cd('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21ea21[_0xe3cd('0x18')]?_0x21ea21['options'][_0xe3cd('0x1a')]||null:null,'attributes':_0x21ea21[_0xe3cd('0x18')]?_0x21ea21['options']['attributes']||null:null,'limit':_0x21ea21[_0xe3cd('0x18')]?_0x21ea21[_0xe3cd('0x18')]['limit']||null:null})[_0xe3cd('0x9')](function(_0x2dc337){logger[_0xe3cd('0x11')](_0xe3cd('0x14'),_0x21ea21);logger[_0xe3cd('0xc')](_0xe3cd('0x14'),_0x21ea21,JSON['stringify'](_0x2dc337));_0x414780(_0x2dc337);})[_0xe3cd('0x13')](function(_0x4c63b3){logger['error']('UpdateFaxApplication',_0x4c63b3[_0xe3cd('0x10')],_0x21ea21);_0x4a16ca(_0x498bc4[_0xe3cd('0xe')](0x1f4,_0x4c63b3['message']));});});};