Built motion from commit (unavailable).|2.5.11
[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 _0x8683=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','ioredis'];(function(_0x32fe5b,_0x464e33){var _0x2440e5=function(_0x43522f){while(--_0x43522f){_0x32fe5b['push'](_0x32fe5b['shift']());}};_0x2440e5(++_0x464e33);}(_0x8683,0xec));var _0x3868=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x8683[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x3868('0x0'));var moment=require(_0x3868('0x1'));var BPromise=require(_0x3868('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3868('0x3'));var db=require(_0x3868('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3868('0x5'))(_0x3868('0x6'));var config=require(_0x3868('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3868('0x8')][_0x3868('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46c6c1,_0x4f87ad,_0x4f73f2){return new BPromise(function(_0x5d4607,_0x451d23){return client['request'](_0x46c6c1,_0x4f73f2)[_0x3868('0xa')](function(_0x2af2f5){logger[_0x3868('0xb')](_0x3868('0xc'),_0x4f87ad,_0x3868('0xd'));logger[_0x3868('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4f87ad,_0x3868('0xd'),JSON[_0x3868('0xf')](_0x2af2f5));if(_0x2af2f5[_0x3868('0x10')]){if(_0x2af2f5['error'][_0x3868('0x11')]===0x1f4){logger[_0x3868('0x10')](_0x3868('0xc'),_0x4f87ad,_0x2af2f5['error'][_0x3868('0x12')]);return _0x451d23(_0x2af2f5[_0x3868('0x10')][_0x3868('0x12')]);}logger[_0x3868('0x10')](_0x3868('0xc'),_0x4f87ad,_0x2af2f5[_0x3868('0x10')][_0x3868('0x12')]);return _0x5d4607(_0x2af2f5['error'][_0x3868('0x12')]);}else{logger[_0x3868('0xb')](_0x3868('0xc'),_0x4f87ad,'request\x20sent');_0x5d4607(_0x2af2f5['result'][_0x3868('0x12')]);}})[_0x3868('0x13')](function(_0xf1e117){logger[_0x3868('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4f87ad,_0xf1e117);_0x451d23(_0xf1e117);});});}