b4d8d72bc8abc767128e4ee520a3e4c343421d5c
[motion2.git] / server / api / openchannelApplication / openchannelApplication.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 _0x2907=['OpenchannelApplication','update','body','options','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x3baa2,_0x474527){var _0x2f7cbc=function(_0x4efc26){while(--_0x4efc26){_0x3baa2['push'](_0x3baa2['shift']());}};_0x2f7cbc(++_0x474527);}(_0x2907,0x157));var _0x7290=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x2907[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x7290('0x0'));var util=require(_0x7290('0x1'));var moment=require(_0x7290('0x2'));var BPromise=require(_0x7290('0x3'));var rs=require(_0x7290('0x4'));var fs=require('fs');var Redis=require(_0x7290('0x5'));var db=require(_0x7290('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7290('0x7'))('rpc');var config=require(_0x7290('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7290('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f3dd4,_0x2f766e,_0x4cd349){return new BPromise(function(_0x14eef6,_0x4bc47c){return client['request'](_0x3f3dd4,_0x4cd349)[_0x7290('0xa')](function(_0x572341){logger[_0x7290('0xb')](_0x7290('0xc'),_0x2f766e,'request\x20sent');logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x2f766e,_0x7290('0xd'),JSON[_0x7290('0xe')](_0x572341));if(_0x572341['error']){if(_0x572341[_0x7290('0xf')][_0x7290('0x10')]===0x1f4){logger[_0x7290('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x2f766e,_0x572341['error'][_0x7290('0x11')]);return _0x4bc47c(_0x572341['error'][_0x7290('0x11')]);}logger[_0x7290('0xf')](_0x7290('0xc'),_0x2f766e,_0x572341['error'][_0x7290('0x11')]);return _0x14eef6(_0x572341[_0x7290('0xf')][_0x7290('0x11')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x2f766e,_0x7290('0xd'));_0x14eef6(_0x572341[_0x7290('0x12')][_0x7290('0x11')]);}})[_0x7290('0x13')](function(_0x48e609){logger[_0x7290('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x2f766e,_0x48e609);_0x4bc47c(_0x48e609);});});}exports[_0x7290('0x14')]=function(_0x5e6ea5){var _0x57cac0=this;return new Promise(function(_0x89909d,_0x19fd85){return db[_0x7290('0x15')][_0x7290('0x16')](_0x5e6ea5[_0x7290('0x17')],{'raw':_0x5e6ea5[_0x7290('0x18')]?_0x5e6ea5['options'][_0x7290('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e6ea5[_0x7290('0x18')]?_0x5e6ea5[_0x7290('0x18')][_0x7290('0x1a')]||null:null,'attributes':_0x5e6ea5[_0x7290('0x18')]?_0x5e6ea5[_0x7290('0x18')][_0x7290('0x1b')]||null:null,'limit':_0x5e6ea5[_0x7290('0x18')]?_0x5e6ea5[_0x7290('0x18')]['limit']||null:null})[_0x7290('0xa')](function(_0x8d5a9b){logger[_0x7290('0xb')](_0x7290('0x14'),_0x5e6ea5);logger['debug'](_0x7290('0x14'),_0x5e6ea5,JSON[_0x7290('0xe')](_0x8d5a9b));_0x89909d(_0x8d5a9b);})[_0x7290('0x13')](function(_0x2bdafb){logger[_0x7290('0xf')](_0x7290('0x14'),_0x2bdafb['message'],_0x5e6ea5);_0x19fd85(_0x57cac0[_0x7290('0xf')](0x1f4,_0x2bdafb[_0x7290('0x11')]));});});};