Built motion from commit 67e5df37.|2.0.66
[motion2.git] / server / api / faxDisposition / faxDisposition.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 _0x89a7=['where','limit','then','UpdateFaxDisposition','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FaxDisposition,\x20%s,\x20%s','debug','FaxDisposition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','FaxDisposition','update','body','options','raw'];(function(_0x2937c1,_0x45d7a1){var _0x2e5d66=function(_0x333218){while(--_0x333218){_0x2937c1['push'](_0x2937c1['shift']());}};_0x2e5d66(++_0x45d7a1);}(_0x89a7,0x14f));var _0x789a=function(_0x20875d,_0x5d6293){_0x20875d=_0x20875d-0x0;var _0x1de324=_0x89a7[_0x20875d];return _0x1de324;};'use strict';var _=require(_0x789a('0x0'));var util=require(_0x789a('0x1'));var moment=require(_0x789a('0x2'));var BPromise=require(_0x789a('0x3'));var rs=require(_0x789a('0x4'));var fs=require('fs');var db=require(_0x789a('0x5'))['db'];var utils=require(_0x789a('0x6'));var logger=require(_0x789a('0x7'))(_0x789a('0x8'));var config=require(_0x789a('0x9'));var jayson=require(_0x789a('0xa'));var client=jayson[_0x789a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cd3e7,_0x26e5d4,_0x2bb20d){return new BPromise(function(_0x1c3530,_0xb7180f){return client[_0x789a('0xc')](_0x1cd3e7,_0x2bb20d)['then'](function(_0x1c923e){logger[_0x789a('0xd')](_0x789a('0xe'),_0x26e5d4,'request\x20sent');logger[_0x789a('0xf')](_0x789a('0x10'),_0x26e5d4,_0x789a('0x11'),JSON[_0x789a('0x12')](_0x1c923e));if(_0x1c923e[_0x789a('0x13')]){if(_0x1c923e['error'][_0x789a('0x14')]===0x1f4){logger[_0x789a('0x13')](_0x789a('0xe'),_0x26e5d4,_0x1c923e['error'][_0x789a('0x15')]);return _0xb7180f(_0x1c923e[_0x789a('0x13')][_0x789a('0x15')]);}logger['error']('FaxDisposition,\x20%s,\x20%s',_0x26e5d4,_0x1c923e[_0x789a('0x13')][_0x789a('0x15')]);return _0x1c3530(_0x1c923e[_0x789a('0x13')]['message']);}else{logger[_0x789a('0xd')](_0x789a('0xe'),_0x26e5d4,_0x789a('0x11'));_0x1c3530(_0x1c923e[_0x789a('0x16')][_0x789a('0x15')]);}})['catch'](function(_0x46330d){logger['error'](_0x789a('0xe'),_0x26e5d4,_0x46330d);_0xb7180f(_0x46330d);});});}exports['UpdateFaxDisposition']=function(_0x1671b9){var _0x4b28af=this;return new Promise(function(_0x19d8e0,_0x30922f){return db[_0x789a('0x17')][_0x789a('0x18')](_0x1671b9[_0x789a('0x19')],{'raw':_0x1671b9[_0x789a('0x1a')]?_0x1671b9['options'][_0x789a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1671b9['options']?_0x1671b9[_0x789a('0x1a')][_0x789a('0x1c')]||null:null,'attributes':_0x1671b9[_0x789a('0x1a')]?_0x1671b9[_0x789a('0x1a')]['attributes']||null:null,'limit':_0x1671b9['options']?_0x1671b9[_0x789a('0x1a')][_0x789a('0x1d')]||null:null})[_0x789a('0x1e')](function(_0x20d1db){logger['info'](_0x789a('0x1f'),_0x1671b9);logger[_0x789a('0xf')](_0x789a('0x1f'),_0x1671b9,JSON['stringify'](_0x20d1db));_0x19d8e0(_0x20d1db);})[_0x789a('0x20')](function(_0xa8caaa){logger[_0x789a('0x13')]('UpdateFaxDisposition',_0xa8caaa['message'],_0x1671b9);_0x30922f(_0x4b28af['error'](0x1f4,_0xa8caaa['message']));});});};