e2338154e91ddb895c493a0cf765720dde5e9598
[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 _0xe798=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment'];(function(_0x12128d,_0x226e88){var _0x2bb696=function(_0x2aa7c5){while(--_0x2aa7c5){_0x12128d['push'](_0x12128d['shift']());}};_0x2bb696(++_0x226e88);}(_0xe798,0xe4));var _0x8e79=function(_0x2c1286,_0x1df92b){_0x2c1286=_0x2c1286-0x0;var _0x3bfc17=_0xe798[_0x2c1286];return _0x3bfc17;};'use strict';var _=require(_0x8e79('0x0'));var util=require(_0x8e79('0x1'));var moment=require(_0x8e79('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e79('0x3'));var fs=require('fs');var Redis=require(_0x8e79('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e79('0x5'));var logger=require(_0x8e79('0x6'))(_0x8e79('0x7'));var config=require(_0x8e79('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8e79('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ea4f2,_0x22d41b,_0x19b51d){return new BPromise(function(_0x8fee14,_0x53bce4){return client['request'](_0x1ea4f2,_0x19b51d)[_0x8e79('0xa')](function(_0x4413f6){logger['info'](_0x8e79('0xb'),_0x22d41b,_0x8e79('0xc'));logger[_0x8e79('0xd')](_0x8e79('0xe'),_0x22d41b,'request\x20sent',JSON[_0x8e79('0xf')](_0x4413f6));if(_0x4413f6[_0x8e79('0x10')]){if(_0x4413f6['error'][_0x8e79('0x11')]===0x1f4){logger[_0x8e79('0x10')](_0x8e79('0xb'),_0x22d41b,_0x4413f6[_0x8e79('0x10')][_0x8e79('0x12')]);return _0x53bce4(_0x4413f6['error']['message']);}logger['error'](_0x8e79('0xb'),_0x22d41b,_0x4413f6[_0x8e79('0x10')][_0x8e79('0x12')]);return _0x8fee14(_0x4413f6[_0x8e79('0x10')]['message']);}else{logger[_0x8e79('0x13')](_0x8e79('0xb'),_0x22d41b,_0x8e79('0xc'));_0x8fee14(_0x4413f6[_0x8e79('0x14')][_0x8e79('0x12')]);}})['catch'](function(_0x3f37d6){logger['error'](_0x8e79('0xb'),_0x22d41b,_0x3f37d6);_0x53bce4(_0x3f37d6);});});}