616046769278fdf02a98d52a93aee7a321c21882
[motion2.git] / server / api / intFreshsalesConfiguration / intFreshsalesConfiguration.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 _0x0c1a=['catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0xaf7ffe,_0x42e884){var _0x1cd872=function(_0x231686){while(--_0x231686){_0xaf7ffe['push'](_0xaf7ffe['shift']());}};_0x1cd872(++_0x42e884);}(_0x0c1a,0x127));var _0xa0c1=function(_0x4fe162,_0x2f2e40){_0x4fe162=_0x4fe162-0x0;var _0x38d0db=_0x0c1a[_0x4fe162];return _0x38d0db;};'use strict';var _=require(_0xa0c1('0x0'));var util=require(_0xa0c1('0x1'));var moment=require(_0xa0c1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa0c1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0c1('0x4'));var logger=require(_0xa0c1('0x5'))(_0xa0c1('0x6'));var config=require(_0xa0c1('0x7'));var jayson=require(_0xa0c1('0x8'));var client=jayson[_0xa0c1('0x9')][_0xa0c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ddfd4,_0x3c0b3b,_0x1f5f8c){return new BPromise(function(_0x5a9ba0,_0x11eee9){return client[_0xa0c1('0xb')](_0x2ddfd4,_0x1f5f8c)[_0xa0c1('0xc')](function(_0x1afec5){logger[_0xa0c1('0xd')](_0xa0c1('0xe'),_0x3c0b3b,'request\x20sent');logger[_0xa0c1('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x3c0b3b,_0xa0c1('0x10'),JSON['stringify'](_0x1afec5));if(_0x1afec5['error']){if(_0x1afec5[_0xa0c1('0x11')][_0xa0c1('0x12')]===0x1f4){logger[_0xa0c1('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3c0b3b,_0x1afec5[_0xa0c1('0x11')][_0xa0c1('0x13')]);return _0x11eee9(_0x1afec5[_0xa0c1('0x11')][_0xa0c1('0x13')]);}logger[_0xa0c1('0x11')](_0xa0c1('0xe'),_0x3c0b3b,_0x1afec5['error']['message']);return _0x5a9ba0(_0x1afec5[_0xa0c1('0x11')][_0xa0c1('0x13')]);}else{logger[_0xa0c1('0xd')](_0xa0c1('0xe'),_0x3c0b3b,_0xa0c1('0x10'));_0x5a9ba0(_0x1afec5['result']['message']);}})[_0xa0c1('0x14')](function(_0x10dc55){logger[_0xa0c1('0x11')](_0xa0c1('0xe'),_0x3c0b3b,_0x10dc55);_0x11eee9(_0x10dc55);});});}