7d3f5b71724f857c2964410047212a17fb65cced
[motion2.git] / server / api / cloudProvider / cloudProvider.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 _0x91b6=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x6e7446,_0x120a01){var _0x167b36=function(_0x909f1a){while(--_0x909f1a){_0x6e7446['push'](_0x6e7446['shift']());}};_0x167b36(++_0x120a01);}(_0x91b6,0x18b));var _0x691b=function(_0x374bbb,_0x1a2762){_0x374bbb=_0x374bbb-0x0;var _0x15a2a7=_0x91b6[_0x374bbb];return _0x15a2a7;};'use strict';var _=require(_0x691b('0x0'));var util=require(_0x691b('0x1'));var moment=require('moment');var BPromise=require(_0x691b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x691b('0x3'))['db'];var utils=require(_0x691b('0x4'));var logger=require(_0x691b('0x5'))(_0x691b('0x6'));var config=require(_0x691b('0x7'));var jayson=require(_0x691b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x448027,_0x1ebd9c,_0x4ff18c){return new BPromise(function(_0x223632,_0xceca6a){return client[_0x691b('0x9')](_0x448027,_0x4ff18c)[_0x691b('0xa')](function(_0xbd8767){logger[_0x691b('0xb')](_0x691b('0xc'),_0x1ebd9c,_0x691b('0xd'));logger['debug'](_0x691b('0xe'),_0x1ebd9c,_0x691b('0xd'),JSON[_0x691b('0xf')](_0xbd8767));if(_0xbd8767[_0x691b('0x10')]){if(_0xbd8767[_0x691b('0x10')][_0x691b('0x11')]===0x1f4){logger['error'](_0x691b('0xc'),_0x1ebd9c,_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);return _0xceca6a(_0xbd8767[_0x691b('0x10')]['message']);}logger[_0x691b('0x10')](_0x691b('0xc'),_0x1ebd9c,_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);return _0x223632(_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);}else{logger[_0x691b('0xb')]('CloudProvider,\x20%s,\x20%s',_0x1ebd9c,_0x691b('0xd'));_0x223632(_0xbd8767['result'][_0x691b('0x12')]);}})[_0x691b('0x13')](function(_0x2e4f84){logger[_0x691b('0x10')](_0x691b('0xc'),_0x1ebd9c,_0x2e4f84);_0xceca6a(_0x2e4f84);});});}