Built motion from commit b5413ace.|2.6.9
[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 _0x87fd=['client','http','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxApplication','options','where','attributes','limit','then','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x58f5f5,_0x1612bd){var _0x3c7ed4=function(_0x11edf2){while(--_0x11edf2){_0x58f5f5['push'](_0x58f5f5['shift']());}};_0x3c7ed4(++_0x1612bd);}(_0x87fd,0x1e3));var _0xd87f=function(_0x493312,_0x3a7b6f){_0x493312=_0x493312-0x0;var _0x12b046=_0x87fd[_0x493312];return _0x12b046;};'use strict';var _=require(_0xd87f('0x0'));var util=require(_0xd87f('0x1'));var moment=require(_0xd87f('0x2'));var BPromise=require('bluebird');var rs=require(_0xd87f('0x3'));var fs=require('fs');var Redis=require(_0xd87f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd87f('0x5'));var logger=require(_0xd87f('0x6'))(_0xd87f('0x7'));var config=require(_0xd87f('0x8'));var jayson=require(_0xd87f('0x9'));var client=jayson[_0xd87f('0xa')][_0xd87f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55d189,_0x73f73a,_0x2c2840){return new BPromise(function(_0x45770f,_0x25ddb5){return client['request'](_0x55d189,_0x2c2840)['then'](function(_0x40b62d){logger[_0xd87f('0xc')](_0xd87f('0xd'),_0x73f73a,'request\x20sent');logger[_0xd87f('0xe')](_0xd87f('0xf'),_0x73f73a,_0xd87f('0x10'),JSON[_0xd87f('0x11')](_0x40b62d));if(_0x40b62d[_0xd87f('0x12')]){if(_0x40b62d['error'][_0xd87f('0x13')]===0x1f4){logger[_0xd87f('0x12')]('FaxApplication,\x20%s,\x20%s',_0x73f73a,_0x40b62d[_0xd87f('0x12')][_0xd87f('0x14')]);return _0x25ddb5(_0x40b62d['error'][_0xd87f('0x14')]);}logger[_0xd87f('0x12')]('FaxApplication,\x20%s,\x20%s',_0x73f73a,_0x40b62d[_0xd87f('0x12')][_0xd87f('0x14')]);return _0x45770f(_0x40b62d['error'][_0xd87f('0x14')]);}else{logger[_0xd87f('0xc')](_0xd87f('0xd'),_0x73f73a,_0xd87f('0x10'));_0x45770f(_0x40b62d[_0xd87f('0x15')][_0xd87f('0x14')]);}})[_0xd87f('0x16')](function(_0x4febc5){logger['error'](_0xd87f('0xd'),_0x73f73a,_0x4febc5);_0x25ddb5(_0x4febc5);});});}exports[_0xd87f('0x17')]=function(_0x46c01b){var _0x1e6fbc=this;return new Promise(function(_0x459106,_0x4faa0a){return db['FaxApplication']['update'](_0x46c01b['body'],{'raw':_0x46c01b[_0xd87f('0x18')]?_0x46c01b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46c01b['options']?_0x46c01b[_0xd87f('0x18')][_0xd87f('0x19')]||null:null,'attributes':_0x46c01b['options']?_0x46c01b[_0xd87f('0x18')][_0xd87f('0x1a')]||null:null,'limit':_0x46c01b['options']?_0x46c01b[_0xd87f('0x18')][_0xd87f('0x1b')]||null:null})[_0xd87f('0x1c')](function(_0x4ee2a7){logger['info'](_0xd87f('0x17'),_0x46c01b);logger[_0xd87f('0xe')]('UpdateFaxApplication',_0x46c01b,JSON[_0xd87f('0x11')](_0x4ee2a7));_0x459106(_0x4ee2a7);})[_0xd87f('0x16')](function(_0x3b4f38){logger[_0xd87f('0x12')](_0xd87f('0x17'),_0x3b4f38['message'],_0x46c01b);_0x4faa0a(_0x1e6fbc[_0xd87f('0x12')](0x1f4,_0x3b4f38['message']));});});};