Built motion from commit (unavailable).|2.5.12
[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 _0xa93a=['rpc','../../config/environment','jayson/promise','client','http','then','debug','request\x20sent','stringify','error','message','FreshsalesField,\x20%s,\x20%s','info','catch','moment','ioredis','../../config/utils'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xa93a,0xb8));var _0xaa93=function(_0x29b152,_0x1fff0d){_0x29b152=_0x29b152-0x0;var _0x90a175=_0xa93a[_0x29b152];return _0x90a175;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaa93('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa93('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa93('0x2'));var logger=require('../../config/logger')(_0xaa93('0x3'));var config=require(_0xaa93('0x4'));var jayson=require(_0xaa93('0x5'));var client=jayson[_0xaa93('0x6')][_0xaa93('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f3572,_0x353544,_0x28e972){return new BPromise(function(_0x5aa7f5,_0x2bb7a8){return client['request'](_0x4f3572,_0x28e972)[_0xaa93('0x8')](function(_0x53897){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x353544,'request\x20sent');logger[_0xaa93('0x9')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x353544,_0xaa93('0xa'),JSON[_0xaa93('0xb')](_0x53897));if(_0x53897[_0xaa93('0xc')]){if(_0x53897['error']['code']===0x1f4){logger[_0xaa93('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x353544,_0x53897[_0xaa93('0xc')]['message']);return _0x2bb7a8(_0x53897[_0xaa93('0xc')][_0xaa93('0xd')]);}logger[_0xaa93('0xc')](_0xaa93('0xe'),_0x353544,_0x53897[_0xaa93('0xc')]['message']);return _0x5aa7f5(_0x53897[_0xaa93('0xc')]['message']);}else{logger[_0xaa93('0xf')](_0xaa93('0xe'),_0x353544,'request\x20sent');_0x5aa7f5(_0x53897['result'][_0xaa93('0xd')]);}})[_0xaa93('0x10')](function(_0x1cc0bc){logger[_0xaa93('0xc')](_0xaa93('0xe'),_0x353544,_0x1cc0bc);_0x2bb7a8(_0x1cc0bc);});});}