67af0194a495ecbb652e5555b0972b3a4f5fae92
[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 _0xe350=['../../config/environment','then','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateFaxApplication','update','body','options','raw','attributes','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe350,0x1b7));var _0x0e35=function(_0xe50de3,_0x5075e8){_0xe50de3=_0xe50de3-0x0;var _0x91170e=_0xe350[_0xe50de3];return _0x91170e;};'use strict';var _=require(_0x0e35('0x0'));var util=require(_0x0e35('0x1'));var moment=require('moment');var BPromise=require(_0x0e35('0x2'));var rs=require(_0x0e35('0x3'));var fs=require('fs');var Redis=require(_0x0e35('0x4'));var db=require(_0x0e35('0x5'))['db'];var utils=require(_0x0e35('0x6'));var logger=require(_0x0e35('0x7'))(_0x0e35('0x8'));var config=require(_0x0e35('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34c84a,_0x38ad1c,_0x5c6cf6){return new BPromise(function(_0xa6085f,_0xbc0ca2){return client['request'](_0x34c84a,_0x5c6cf6)[_0x0e35('0xa')](function(_0x2cb818){logger['info'](_0x0e35('0xb'),_0x38ad1c,_0x0e35('0xc'));logger['debug'](_0x0e35('0xd'),_0x38ad1c,_0x0e35('0xc'),JSON[_0x0e35('0xe')](_0x2cb818));if(_0x2cb818[_0x0e35('0xf')]){if(_0x2cb818[_0x0e35('0xf')][_0x0e35('0x10')]===0x1f4){logger[_0x0e35('0xf')](_0x0e35('0xb'),_0x38ad1c,_0x2cb818[_0x0e35('0xf')][_0x0e35('0x11')]);return _0xbc0ca2(_0x2cb818[_0x0e35('0xf')][_0x0e35('0x11')]);}logger[_0x0e35('0xf')]('FaxApplication,\x20%s,\x20%s',_0x38ad1c,_0x2cb818[_0x0e35('0xf')][_0x0e35('0x11')]);return _0xa6085f(_0x2cb818[_0x0e35('0xf')][_0x0e35('0x11')]);}else{logger[_0x0e35('0x12')](_0x0e35('0xb'),_0x38ad1c,_0x0e35('0xc'));_0xa6085f(_0x2cb818[_0x0e35('0x13')]['message']);}})[_0x0e35('0x14')](function(_0x3fdc59){logger['error'](_0x0e35('0xb'),_0x38ad1c,_0x3fdc59);_0xbc0ca2(_0x3fdc59);});});}exports[_0x0e35('0x15')]=function(_0x25bcef){var _0x207c14=this;return new Promise(function(_0x31fb7a,_0x306443){return db['FaxApplication'][_0x0e35('0x16')](_0x25bcef[_0x0e35('0x17')],{'raw':_0x25bcef[_0x0e35('0x18')]?_0x25bcef[_0x0e35('0x18')][_0x0e35('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25bcef[_0x0e35('0x18')]?_0x25bcef[_0x0e35('0x18')]['where']||null:null,'attributes':_0x25bcef['options']?_0x25bcef[_0x0e35('0x18')][_0x0e35('0x1a')]||null:null,'limit':_0x25bcef[_0x0e35('0x18')]?_0x25bcef[_0x0e35('0x18')]['limit']||null:null})['then'](function(_0x95be7){logger[_0x0e35('0x12')]('UpdateFaxApplication',_0x25bcef);logger[_0x0e35('0x1b')](_0x0e35('0x15'),_0x25bcef,JSON[_0x0e35('0xe')](_0x95be7));_0x31fb7a(_0x95be7);})['catch'](function(_0x2a7b55){logger['error'](_0x0e35('0x15'),_0x2a7b55[_0x0e35('0x11')],_0x25bcef);_0x306443(_0x207c14[_0x0e35('0xf')](0x1f4,_0x2a7b55['message']));});});};