3fa6c5378a0471da8f6b80f551d26b85e4f27c84
[motion2.git] / server / api / intFreshsalesField / intFreshsalesField.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 _0x0f73=['stringify','error','FreshsalesField,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x0f73,0x135));var _0x30f7=function(_0x3642ac,_0x1ec3bb){_0x3642ac=_0x3642ac-0x0;var _0x21d2fd=_0x0f73[_0x3642ac];return _0x21d2fd;};'use strict';var _=require(_0x30f7('0x0'));var util=require(_0x30f7('0x1'));var moment=require(_0x30f7('0x2'));var BPromise=require('bluebird');var rs=require(_0x30f7('0x3'));var fs=require('fs');var Redis=require(_0x30f7('0x4'));var db=require(_0x30f7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x30f7('0x6'))('rpc');var config=require(_0x30f7('0x7'));var jayson=require(_0x30f7('0x8'));var client=jayson['client'][_0x30f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42e564,_0x45a41e,_0x502b5c){return new BPromise(function(_0x2277d7,_0x55598f){return client['request'](_0x42e564,_0x502b5c)[_0x30f7('0xa')](function(_0x2826b8){logger[_0x30f7('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x45a41e,_0x30f7('0xc'));logger[_0x30f7('0xd')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x45a41e,'request\x20sent',JSON[_0x30f7('0xe')](_0x2826b8));if(_0x2826b8[_0x30f7('0xf')]){if(_0x2826b8[_0x30f7('0xf')]['code']===0x1f4){logger[_0x30f7('0xf')](_0x30f7('0x10'),_0x45a41e,_0x2826b8[_0x30f7('0xf')]['message']);return _0x55598f(_0x2826b8[_0x30f7('0xf')][_0x30f7('0x11')]);}logger['error'](_0x30f7('0x10'),_0x45a41e,_0x2826b8[_0x30f7('0xf')]['message']);return _0x2277d7(_0x2826b8[_0x30f7('0xf')]['message']);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x45a41e,_0x30f7('0xc'));_0x2277d7(_0x2826b8['result'][_0x30f7('0x11')]);}})[_0x30f7('0x12')](function(_0x47e18d){logger[_0x30f7('0xf')](_0x30f7('0x10'),_0x45a41e,_0x47e18d);_0x55598f(_0x47e18d);});});}