Built motion from commit 4fa9d4a7.|2.6.31
[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 _0x9312=['FaxApplication','update','options','raw','attributes','limit','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication'];(function(_0x57ea41,_0x9d4dc9){var _0xa50e41=function(_0x3ecdf7){while(--_0x3ecdf7){_0x57ea41['push'](_0x57ea41['shift']());}};_0xa50e41(++_0x9d4dc9);}(_0x9312,0x1aa));var _0x2931=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0x9312[_0xb65e77];return _0x38134b;};'use strict';var _=require('lodash');var util=require(_0x2931('0x0'));var moment=require(_0x2931('0x1'));var BPromise=require('bluebird');var rs=require(_0x2931('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2931('0x3'));var logger=require(_0x2931('0x4'))(_0x2931('0x5'));var config=require(_0x2931('0x6'));var jayson=require(_0x2931('0x7'));var client=jayson[_0x2931('0x8')][_0x2931('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d6894,_0x4c9644,_0x5d6cfd){return new BPromise(function(_0x4963f6,_0x191e7e){return client['request'](_0x2d6894,_0x5d6cfd)[_0x2931('0xa')](function(_0x22ae16){logger[_0x2931('0xb')]('FaxApplication,\x20%s,\x20%s',_0x4c9644,_0x2931('0xc'));logger[_0x2931('0xd')](_0x2931('0xe'),_0x4c9644,_0x2931('0xc'),JSON[_0x2931('0xf')](_0x22ae16));if(_0x22ae16[_0x2931('0x10')]){if(_0x22ae16['error']['code']===0x1f4){logger[_0x2931('0x10')](_0x2931('0x11'),_0x4c9644,_0x22ae16[_0x2931('0x10')][_0x2931('0x12')]);return _0x191e7e(_0x22ae16[_0x2931('0x10')][_0x2931('0x12')]);}logger[_0x2931('0x10')](_0x2931('0x11'),_0x4c9644,_0x22ae16[_0x2931('0x10')][_0x2931('0x12')]);return _0x4963f6(_0x22ae16['error'][_0x2931('0x12')]);}else{logger['info'](_0x2931('0x11'),_0x4c9644,'request\x20sent');_0x4963f6(_0x22ae16[_0x2931('0x13')]['message']);}})[_0x2931('0x14')](function(_0x509674){logger[_0x2931('0x10')](_0x2931('0x11'),_0x4c9644,_0x509674);_0x191e7e(_0x509674);});});}exports[_0x2931('0x15')]=function(_0x22863f){var _0x30139c=this;return new Promise(function(_0xef7751,_0x3181bf){return db[_0x2931('0x16')][_0x2931('0x17')](_0x22863f['body'],{'raw':_0x22863f[_0x2931('0x18')]?_0x22863f['options'][_0x2931('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22863f['options']?_0x22863f['options']['where']||null:null,'attributes':_0x22863f[_0x2931('0x18')]?_0x22863f['options'][_0x2931('0x1a')]||null:null,'limit':_0x22863f[_0x2931('0x18')]?_0x22863f[_0x2931('0x18')][_0x2931('0x1b')]||null:null})[_0x2931('0xa')](function(_0x4e333b){logger[_0x2931('0xb')](_0x2931('0x15'),_0x22863f);logger['debug'](_0x2931('0x15'),_0x22863f,JSON[_0x2931('0xf')](_0x4e333b));_0xef7751(_0x4e333b);})[_0x2931('0x14')](function(_0x5615c5){logger[_0x2931('0x10')](_0x2931('0x15'),_0x5615c5[_0x2931('0x12')],_0x22863f);_0x3181bf(_0x30139c['error'](0x1f4,_0x5615c5[_0x2931('0x12')]));});});};