Built motion from commit (unavailable).|2.5.5
[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 _0x2f77=['message','FreshsalesField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x92713a,_0x68f8b0){var _0x1893e1=function(_0xe49768){while(--_0xe49768){_0x92713a['push'](_0x92713a['shift']());}};_0x1893e1(++_0x68f8b0);}(_0x2f77,0x1d2));var _0x72f7=function(_0x249d60,_0x4ca7d8){_0x249d60=_0x249d60-0x0;var _0x5d0a19=_0x2f77[_0x249d60];return _0x5d0a19;};'use strict';var _=require(_0x72f7('0x0'));var util=require(_0x72f7('0x1'));var moment=require(_0x72f7('0x2'));var BPromise=require(_0x72f7('0x3'));var rs=require(_0x72f7('0x4'));var fs=require('fs');var Redis=require(_0x72f7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x72f7('0x6'));var logger=require(_0x72f7('0x7'))(_0x72f7('0x8'));var config=require(_0x72f7('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xae69e0,_0x134993,_0x55f681){return new BPromise(function(_0x37495f,_0x5aa1ec){return client[_0x72f7('0xa')](_0xae69e0,_0x55f681)['then'](function(_0xb480fd){logger[_0x72f7('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x134993,_0x72f7('0xc'));logger['debug'](_0x72f7('0xd'),_0x134993,'request\x20sent',JSON[_0x72f7('0xe')](_0xb480fd));if(_0xb480fd[_0x72f7('0xf')]){if(_0xb480fd['error'][_0x72f7('0x10')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x134993,_0xb480fd[_0x72f7('0xf')][_0x72f7('0x11')]);return _0x5aa1ec(_0xb480fd[_0x72f7('0xf')][_0x72f7('0x11')]);}logger[_0x72f7('0xf')](_0x72f7('0x12'),_0x134993,_0xb480fd['error']['message']);return _0x37495f(_0xb480fd[_0x72f7('0xf')][_0x72f7('0x11')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x134993,_0x72f7('0xc'));_0x37495f(_0xb480fd[_0x72f7('0x13')][_0x72f7('0x11')]);}})[_0x72f7('0x14')](function(_0x53bcf5){logger[_0x72f7('0xf')](_0x72f7('0x12'),_0x134993,_0x53bcf5);_0x5aa1ec(_0x53bcf5);});});}