53431af38e088de3b6fb451b8721e9e1fad7f14c
[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 _0xa218=['request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x5b7b6c,_0x417155){var _0x4a0e09=function(_0x59c2d1){while(--_0x59c2d1){_0x5b7b6c['push'](_0x5b7b6c['shift']());}};_0x4a0e09(++_0x417155);}(_0xa218,0xa6));var _0x8a21=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xa218[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0x8a21('0x0'));var util=require(_0x8a21('0x1'));var moment=require('moment');var BPromise=require(_0x8a21('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a21('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a21('0x4'));var logger=require(_0x8a21('0x5'))(_0x8a21('0x6'));var config=require(_0x8a21('0x7'));var jayson=require(_0x8a21('0x8'));var client=jayson['client'][_0x8a21('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f46ef,_0x143f3d,_0x1ca9b6){return new BPromise(function(_0x45bbf0,_0x3b4de1){return client[_0x8a21('0xa')](_0x2f46ef,_0x1ca9b6)[_0x8a21('0xb')](function(_0x11476f){logger[_0x8a21('0xc')](_0x8a21('0xd'),_0x143f3d,_0x8a21('0xe'));logger[_0x8a21('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x143f3d,_0x8a21('0xe'),JSON[_0x8a21('0x10')](_0x11476f));if(_0x11476f[_0x8a21('0x11')]){if(_0x11476f[_0x8a21('0x11')][_0x8a21('0x12')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x143f3d,_0x11476f['error'][_0x8a21('0x13')]);return _0x3b4de1(_0x11476f[_0x8a21('0x11')]['message']);}logger[_0x8a21('0x11')](_0x8a21('0xd'),_0x143f3d,_0x11476f[_0x8a21('0x11')][_0x8a21('0x13')]);return _0x45bbf0(_0x11476f[_0x8a21('0x11')][_0x8a21('0x13')]);}else{logger[_0x8a21('0xc')](_0x8a21('0xd'),_0x143f3d,_0x8a21('0xe'));_0x45bbf0(_0x11476f[_0x8a21('0x14')]['message']);}})[_0x8a21('0x15')](function(_0x3db3f4){logger[_0x8a21('0x11')]('ZohoField,\x20%s,\x20%s',_0x143f3d,_0x3db3f4);_0x3b4de1(_0x3db3f4);});});}