Built motion from commit 092f8824.|2.5.49
[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 _0xcac4=['rpc','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x506f5b,_0x165b62){var _0x5dba09=function(_0x307d26){while(--_0x307d26){_0x506f5b['push'](_0x506f5b['shift']());}};_0x5dba09(++_0x165b62);}(_0xcac4,0xc1));var _0x4cac=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xcac4[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4cac('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cac('0x1'));var db=require(_0x4cac('0x2'))['db'];var utils=require(_0x4cac('0x3'));var logger=require(_0x4cac('0x4'))(_0x4cac('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x40caf1,_0x1b1a54,_0x1310f6){return new BPromise(function(_0x414d15,_0x5c1d9){return client[_0x4cac('0x6')](_0x40caf1,_0x1310f6)[_0x4cac('0x7')](function(_0x515916){logger[_0x4cac('0x8')](_0x4cac('0x9'),_0x1b1a54,_0x4cac('0xa'));logger[_0x4cac('0xb')](_0x4cac('0xc'),_0x1b1a54,_0x4cac('0xa'),JSON[_0x4cac('0xd')](_0x515916));if(_0x515916[_0x4cac('0xe')]){if(_0x515916[_0x4cac('0xe')]['code']===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x1b1a54,_0x515916[_0x4cac('0xe')]['message']);return _0x5c1d9(_0x515916[_0x4cac('0xe')][_0x4cac('0xf')]);}logger[_0x4cac('0xe')](_0x4cac('0x9'),_0x1b1a54,_0x515916[_0x4cac('0xe')][_0x4cac('0xf')]);return _0x414d15(_0x515916['error'][_0x4cac('0xf')]);}else{logger[_0x4cac('0x8')](_0x4cac('0x9'),_0x1b1a54,_0x4cac('0xa'));_0x414d15(_0x515916[_0x4cac('0x10')]['message']);}})[_0x4cac('0x11')](function(_0x35f5aa){logger[_0x4cac('0xe')](_0x4cac('0x9'),_0x1b1a54,_0x35f5aa);_0x5c1d9(_0x35f5aa);});});}