b4a282a282bdbb69a7f0c86a634e6823cb6b908b
[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 _0xace9=['attributes','limit','debug','UpdateFaxApplication','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','FaxApplication','update','body','options'];(function(_0x4008de,_0x15f2e9){var _0x596738=function(_0x2d4060){while(--_0x2d4060){_0x4008de['push'](_0x4008de['shift']());}};_0x596738(++_0x15f2e9);}(_0xace9,0x148));var _0x9ace=function(_0x3d9e55,_0x407319){_0x3d9e55=_0x3d9e55-0x0;var _0x4e7408=_0xace9[_0x3d9e55];return _0x4e7408;};'use strict';var _=require(_0x9ace('0x0'));var util=require('util');var moment=require(_0x9ace('0x1'));var BPromise=require(_0x9ace('0x2'));var rs=require(_0x9ace('0x3'));var fs=require('fs');var Redis=require(_0x9ace('0x4'));var db=require(_0x9ace('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ace('0x6'))(_0x9ace('0x7'));var config=require('../../config/environment');var jayson=require(_0x9ace('0x8'));var client=jayson[_0x9ace('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43065a,_0x5ede12,_0x44cdfb){return new BPromise(function(_0x372956,_0x5ab915){return client[_0x9ace('0xa')](_0x43065a,_0x44cdfb)['then'](function(_0x4c977b){logger[_0x9ace('0xb')](_0x9ace('0xc'),_0x5ede12,_0x9ace('0xd'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x5ede12,_0x9ace('0xd'),JSON[_0x9ace('0xe')](_0x4c977b));if(_0x4c977b['error']){if(_0x4c977b[_0x9ace('0xf')]['code']===0x1f4){logger[_0x9ace('0xf')](_0x9ace('0xc'),_0x5ede12,_0x4c977b[_0x9ace('0xf')][_0x9ace('0x10')]);return _0x5ab915(_0x4c977b[_0x9ace('0xf')]['message']);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x5ede12,_0x4c977b[_0x9ace('0xf')][_0x9ace('0x10')]);return _0x372956(_0x4c977b['error'][_0x9ace('0x10')]);}else{logger[_0x9ace('0xb')](_0x9ace('0xc'),_0x5ede12,_0x9ace('0xd'));_0x372956(_0x4c977b[_0x9ace('0x11')][_0x9ace('0x10')]);}})[_0x9ace('0x12')](function(_0x48b37d){logger[_0x9ace('0xf')](_0x9ace('0xc'),_0x5ede12,_0x48b37d);_0x5ab915(_0x48b37d);});});}exports['UpdateFaxApplication']=function(_0x313167){var _0x18e7ed=this;return new Promise(function(_0x474d4a,_0x4bd4b9){return db[_0x9ace('0x13')][_0x9ace('0x14')](_0x313167[_0x9ace('0x15')],{'raw':_0x313167[_0x9ace('0x16')]?_0x313167[_0x9ace('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x313167[_0x9ace('0x16')]?_0x313167['options']['where']||null:null,'attributes':_0x313167[_0x9ace('0x16')]?_0x313167[_0x9ace('0x16')][_0x9ace('0x17')]||null:null,'limit':_0x313167[_0x9ace('0x16')]?_0x313167[_0x9ace('0x16')][_0x9ace('0x18')]||null:null})['then'](function(_0x176b81){logger[_0x9ace('0xb')]('UpdateFaxApplication',_0x313167);logger[_0x9ace('0x19')](_0x9ace('0x1a'),_0x313167,JSON[_0x9ace('0xe')](_0x176b81));_0x474d4a(_0x176b81);})[_0x9ace('0x12')](function(_0x56faf2){logger['error'](_0x9ace('0x1a'),_0x56faf2['message'],_0x313167);_0x4bd4b9(_0x18e7ed[_0x9ace('0xf')](0x1f4,_0x56faf2[_0x9ace('0x10')]));});});};