8286a700339c02c83cba13eb4dcfc63c20d5cf3a
[motion2.git] / server / api / intZohoField / intZohoField.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 _0x5e1b=['http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5e1b,0x150));var _0xb5e1=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0x5e1b[_0x155c64];return _0x1f154a;};'use strict';var _=require('lodash');var util=require(_0xb5e1('0x0'));var moment=require('moment');var BPromise=require(_0xb5e1('0x1'));var rs=require(_0xb5e1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb5e1('0x3'))['db'];var utils=require(_0xb5e1('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb5e1('0x5'));var client=jayson['client'][_0xb5e1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1944cd,_0x323d2e,_0x1e4be2){return new BPromise(function(_0x238367,_0xa98af3){return client[_0xb5e1('0x7')](_0x1944cd,_0x1e4be2)[_0xb5e1('0x8')](function(_0x36c572){logger[_0xb5e1('0x9')](_0xb5e1('0xa'),_0x323d2e,_0xb5e1('0xb'));logger[_0xb5e1('0xc')](_0xb5e1('0xd'),_0x323d2e,_0xb5e1('0xb'),JSON['stringify'](_0x36c572));if(_0x36c572['error']){if(_0x36c572[_0xb5e1('0xe')]['code']===0x1f4){logger[_0xb5e1('0xe')](_0xb5e1('0xa'),_0x323d2e,_0x36c572[_0xb5e1('0xe')][_0xb5e1('0xf')]);return _0xa98af3(_0x36c572[_0xb5e1('0xe')][_0xb5e1('0xf')]);}logger[_0xb5e1('0xe')](_0xb5e1('0xa'),_0x323d2e,_0x36c572[_0xb5e1('0xe')][_0xb5e1('0xf')]);return _0x238367(_0x36c572[_0xb5e1('0xe')][_0xb5e1('0xf')]);}else{logger[_0xb5e1('0x9')](_0xb5e1('0xa'),_0x323d2e,_0xb5e1('0xb'));_0x238367(_0x36c572[_0xb5e1('0x10')][_0xb5e1('0xf')]);}})[_0xb5e1('0x11')](function(_0x266161){logger[_0xb5e1('0xe')](_0xb5e1('0xa'),_0x323d2e,_0x266161);_0xa98af3(_0x266161);});});}