Built motion from commit c738b9ac.|2.6.25
[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 _0x4583=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','FaxApplication','update','body','options','where','limit','debug','UpdateFaxApplication','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4583,0x17a));var _0x3458=function(_0x301f36,_0x510564){_0x301f36=_0x301f36-0x0;var _0x269f6a=_0x4583[_0x301f36];return _0x269f6a;};'use strict';var _=require('lodash');var util=require(_0x3458('0x0'));var moment=require(_0x3458('0x1'));var BPromise=require(_0x3458('0x2'));var rs=require(_0x3458('0x3'));var fs=require('fs');var Redis=require(_0x3458('0x4'));var db=require(_0x3458('0x5'))['db'];var utils=require(_0x3458('0x6'));var logger=require(_0x3458('0x7'))(_0x3458('0x8'));var config=require(_0x3458('0x9'));var jayson=require(_0x3458('0xa'));var client=jayson[_0x3458('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17e73d,_0x4b24dc,_0x3fc401){return new BPromise(function(_0x3001ce,_0x300eea){return client[_0x3458('0xc')](_0x17e73d,_0x3fc401)[_0x3458('0xd')](function(_0x3bbcef){logger[_0x3458('0xe')]('FaxApplication,\x20%s,\x20%s',_0x4b24dc,_0x3458('0xf'));logger['debug'](_0x3458('0x10'),_0x4b24dc,_0x3458('0xf'),JSON[_0x3458('0x11')](_0x3bbcef));if(_0x3bbcef['error']){if(_0x3bbcef[_0x3458('0x12')][_0x3458('0x13')]===0x1f4){logger[_0x3458('0x12')](_0x3458('0x14'),_0x4b24dc,_0x3bbcef[_0x3458('0x12')][_0x3458('0x15')]);return _0x300eea(_0x3bbcef[_0x3458('0x12')][_0x3458('0x15')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x4b24dc,_0x3bbcef['error']['message']);return _0x3001ce(_0x3bbcef[_0x3458('0x12')]['message']);}else{logger[_0x3458('0xe')](_0x3458('0x14'),_0x4b24dc,_0x3458('0xf'));_0x3001ce(_0x3bbcef[_0x3458('0x16')][_0x3458('0x15')]);}})[_0x3458('0x17')](function(_0x5aede6){logger[_0x3458('0x12')](_0x3458('0x14'),_0x4b24dc,_0x5aede6);_0x300eea(_0x5aede6);});});}exports['UpdateFaxApplication']=function(_0x40fb8e){var _0x5cd2c8=this;return new Promise(function(_0x4dda61,_0x204626){return db[_0x3458('0x18')][_0x3458('0x19')](_0x40fb8e[_0x3458('0x1a')],{'raw':_0x40fb8e[_0x3458('0x1b')]?_0x40fb8e[_0x3458('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40fb8e['options']?_0x40fb8e[_0x3458('0x1b')][_0x3458('0x1c')]||null:null,'attributes':_0x40fb8e['options']?_0x40fb8e['options']['attributes']||null:null,'limit':_0x40fb8e['options']?_0x40fb8e['options'][_0x3458('0x1d')]||null:null})[_0x3458('0xd')](function(_0x19d40f){logger[_0x3458('0xe')]('UpdateFaxApplication',_0x40fb8e);logger[_0x3458('0x1e')](_0x3458('0x1f'),_0x40fb8e,JSON['stringify'](_0x19d40f));_0x4dda61(_0x19d40f);})[_0x3458('0x17')](function(_0x4f56e0){logger[_0x3458('0x12')](_0x3458('0x1f'),_0x4f56e0[_0x3458('0x15')],_0x40fb8e);_0x204626(_0x5cd2c8[_0x3458('0x12')](0x1f4,_0x4f56e0['message']));});});};