a9f3af1e86dd14bbc5ac1115f3d177573a019a53
[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 _0x03ad=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x03ad,0xe0));var _0xd03a=function(_0x534817,_0x55cc0a){_0x534817=_0x534817-0x0;var _0x4e3ecb=_0x03ad[_0x534817];return _0x4e3ecb;};'use strict';var _=require(_0xd03a('0x0'));var util=require('util');var moment=require(_0xd03a('0x1'));var BPromise=require(_0xd03a('0x2'));var rs=require(_0xd03a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd03a('0x4'))['db'];var utils=require(_0xd03a('0x5'));var logger=require(_0xd03a('0x6'))(_0xd03a('0x7'));var config=require(_0xd03a('0x8'));var jayson=require(_0xd03a('0x9'));var client=jayson[_0xd03a('0xa')][_0xd03a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x257a99,_0x191345,_0x12f8dc){return new BPromise(function(_0xbc7a97,_0x4763a3){return client[_0xd03a('0xc')](_0x257a99,_0x12f8dc)[_0xd03a('0xd')](function(_0xed6bf5){logger[_0xd03a('0xe')](_0xd03a('0xf'),_0x191345,_0xd03a('0x10'));logger['debug'](_0xd03a('0x11'),_0x191345,_0xd03a('0x10'),JSON[_0xd03a('0x12')](_0xed6bf5));if(_0xed6bf5[_0xd03a('0x13')]){if(_0xed6bf5[_0xd03a('0x13')][_0xd03a('0x14')]===0x1f4){logger[_0xd03a('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x191345,_0xed6bf5['error'][_0xd03a('0x15')]);return _0x4763a3(_0xed6bf5[_0xd03a('0x13')][_0xd03a('0x15')]);}logger[_0xd03a('0x13')](_0xd03a('0xf'),_0x191345,_0xed6bf5['error'][_0xd03a('0x15')]);return _0xbc7a97(_0xed6bf5['error']['message']);}else{logger[_0xd03a('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x191345,_0xd03a('0x10'));_0xbc7a97(_0xed6bf5['result'][_0xd03a('0x15')]);}})[_0xd03a('0x16')](function(_0x1d3ec6){logger[_0xd03a('0x13')](_0xd03a('0xf'),_0x191345,_0x1d3ec6);_0x4763a3(_0x1d3ec6);});});}