b62251cc13f1153638e6a0360b9586846d5e6769
[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 _0x96e3=['bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment'];(function(_0x133d16,_0x530129){var _0xf3e73f=function(_0x63a29e){while(--_0x63a29e){_0x133d16['push'](_0x133d16['shift']());}};_0xf3e73f(++_0x530129);}(_0x96e3,0x17a));var _0x396e=function(_0xe3cac3,_0x526da4){_0xe3cac3=_0xe3cac3-0x0;var _0x10edd9=_0x96e3[_0xe3cac3];return _0x10edd9;};'use strict';var _=require('lodash');var util=require(_0x396e('0x0'));var moment=require(_0x396e('0x1'));var BPromise=require(_0x396e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x396e('0x3'));var db=require(_0x396e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x396e('0x5'));var config=require('../../config/environment');var jayson=require(_0x396e('0x6'));var client=jayson[_0x396e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x911e2a,_0x49b2f5,_0x3fdaea){return new BPromise(function(_0x42f20d,_0x52e5ee){return client[_0x396e('0x8')](_0x911e2a,_0x3fdaea)[_0x396e('0x9')](function(_0xfa4718){logger[_0x396e('0xa')](_0x396e('0xb'),_0x49b2f5,_0x396e('0xc'));logger[_0x396e('0xd')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x49b2f5,_0x396e('0xc'),JSON[_0x396e('0xe')](_0xfa4718));if(_0xfa4718[_0x396e('0xf')]){if(_0xfa4718['error'][_0x396e('0x10')]===0x1f4){logger[_0x396e('0xf')](_0x396e('0xb'),_0x49b2f5,_0xfa4718['error'][_0x396e('0x11')]);return _0x52e5ee(_0xfa4718[_0x396e('0xf')][_0x396e('0x11')]);}logger[_0x396e('0xf')](_0x396e('0xb'),_0x49b2f5,_0xfa4718[_0x396e('0xf')][_0x396e('0x11')]);return _0x42f20d(_0xfa4718['error'][_0x396e('0x11')]);}else{logger[_0x396e('0xa')](_0x396e('0xb'),_0x49b2f5,_0x396e('0xc'));_0x42f20d(_0xfa4718['result']['message']);}})[_0x396e('0x12')](function(_0xbb8496){logger['error'](_0x396e('0xb'),_0x49b2f5,_0xbb8496);_0x52e5ee(_0xbb8496);});});}