7645d72359794730911169372ab15046cf38d6d5
[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 _0xc2cf=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x20a457,_0x3d866b){var _0x1a5293=function(_0x1d8b93){while(--_0x1d8b93){_0x20a457['push'](_0x20a457['shift']());}};_0x1a5293(++_0x3d866b);}(_0xc2cf,0x1a1));var _0xfc2c=function(_0x613c62,_0x523ae7){_0x613c62=_0x613c62-0x0;var _0x39a9f4=_0xc2cf[_0x613c62];return _0x39a9f4;};'use strict';var _=require(_0xfc2c('0x0'));var util=require('util');var moment=require(_0xfc2c('0x1'));var BPromise=require(_0xfc2c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc2c('0x3'));var db=require(_0xfc2c('0x4'))['db'];var utils=require(_0xfc2c('0x5'));var logger=require('../../config/logger')(_0xfc2c('0x6'));var config=require(_0xfc2c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfc2c('0x8')][_0xfc2c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x453ba4,_0x568a42,_0x43ed70){return new BPromise(function(_0x27eaa1,_0x1bf841){return client[_0xfc2c('0xa')](_0x453ba4,_0x43ed70)[_0xfc2c('0xb')](function(_0x2e1c60){logger[_0xfc2c('0xc')](_0xfc2c('0xd'),_0x568a42,_0xfc2c('0xe'));logger['debug'](_0xfc2c('0xf'),_0x568a42,_0xfc2c('0xe'),JSON[_0xfc2c('0x10')](_0x2e1c60));if(_0x2e1c60[_0xfc2c('0x11')]){if(_0x2e1c60['error'][_0xfc2c('0x12')]===0x1f4){logger[_0xfc2c('0x11')](_0xfc2c('0xd'),_0x568a42,_0x2e1c60[_0xfc2c('0x11')][_0xfc2c('0x13')]);return _0x1bf841(_0x2e1c60[_0xfc2c('0x11')]['message']);}logger[_0xfc2c('0x11')](_0xfc2c('0xd'),_0x568a42,_0x2e1c60[_0xfc2c('0x11')][_0xfc2c('0x13')]);return _0x27eaa1(_0x2e1c60['error'][_0xfc2c('0x13')]);}else{logger[_0xfc2c('0xc')](_0xfc2c('0xd'),_0x568a42,_0xfc2c('0xe'));_0x27eaa1(_0x2e1c60[_0xfc2c('0x14')][_0xfc2c('0x13')]);}})['catch'](function(_0x5b0633){logger['error'](_0xfc2c('0xd'),_0x568a42,_0x5b0633);_0x1bf841(_0x5b0633);});});}