Built motion from commit (unavailable).|2.5.11
[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 _0x83fb=['jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','UpdateFaxApplication','FaxApplication','body','options','where','attributes','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x83fb,0xf4));var _0xb83f=function(_0x3eef0d,_0x38a38b){_0x3eef0d=_0x3eef0d-0x0;var _0x2c78fc=_0x83fb[_0x3eef0d];return _0x2c78fc;};'use strict';var _=require(_0xb83f('0x0'));var util=require(_0xb83f('0x1'));var moment=require(_0xb83f('0x2'));var BPromise=require(_0xb83f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb83f('0x4'));var db=require(_0xb83f('0x5'))['db'];var utils=require(_0xb83f('0x6'));var logger=require('../../config/logger')(_0xb83f('0x7'));var config=require('../../config/environment');var jayson=require(_0xb83f('0x8'));var client=jayson[_0xb83f('0x9')][_0xb83f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x389958,_0x5b2ac6,_0x5d6263){return new BPromise(function(_0x495a67,_0x5cef51){return client[_0xb83f('0xb')](_0x389958,_0x5d6263)[_0xb83f('0xc')](function(_0xcb42cb){logger['info'](_0xb83f('0xd'),_0x5b2ac6,'request\x20sent');logger[_0xb83f('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x5b2ac6,_0xb83f('0xf'),JSON['stringify'](_0xcb42cb));if(_0xcb42cb[_0xb83f('0x10')]){if(_0xcb42cb[_0xb83f('0x10')][_0xb83f('0x11')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x5b2ac6,_0xcb42cb[_0xb83f('0x10')]['message']);return _0x5cef51(_0xcb42cb[_0xb83f('0x10')][_0xb83f('0x12')]);}logger['error'](_0xb83f('0xd'),_0x5b2ac6,_0xcb42cb[_0xb83f('0x10')]['message']);return _0x495a67(_0xcb42cb[_0xb83f('0x10')]['message']);}else{logger[_0xb83f('0x13')]('FaxApplication,\x20%s,\x20%s',_0x5b2ac6,_0xb83f('0xf'));_0x495a67(_0xcb42cb['result']['message']);}})[_0xb83f('0x14')](function(_0x5eae5f){logger[_0xb83f('0x10')](_0xb83f('0xd'),_0x5b2ac6,_0x5eae5f);_0x5cef51(_0x5eae5f);});});}exports[_0xb83f('0x15')]=function(_0x1726f0){var _0x407963=this;return new Promise(function(_0x21e342,_0x18c5ce){return db[_0xb83f('0x16')]['update'](_0x1726f0[_0xb83f('0x17')],{'raw':_0x1726f0['options']?_0x1726f0[_0xb83f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1726f0[_0xb83f('0x18')]?_0x1726f0[_0xb83f('0x18')][_0xb83f('0x19')]||null:null,'attributes':_0x1726f0['options']?_0x1726f0['options'][_0xb83f('0x1a')]||null:null,'limit':_0x1726f0[_0xb83f('0x18')]?_0x1726f0[_0xb83f('0x18')]['limit']||null:null})[_0xb83f('0xc')](function(_0x1488ac){logger[_0xb83f('0x13')](_0xb83f('0x15'),_0x1726f0);logger['debug']('UpdateFaxApplication',_0x1726f0,JSON[_0xb83f('0x1b')](_0x1488ac));_0x21e342(_0x1488ac);})[_0xb83f('0x14')](function(_0x2d47b5){logger['error'](_0xb83f('0x15'),_0x2d47b5[_0xb83f('0x12')],_0x1726f0);_0x18c5ce(_0x407963[_0xb83f('0x10')](0x1f4,_0x2d47b5[_0xb83f('0x12')]));});});};