Built motion from commit 3c2ce842.|2.6.31
[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 _0x9cf4=['jayson/promise','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x449892,_0x2a2cb7){var _0x3cde6a=function(_0xe393af){while(--_0xe393af){_0x449892['push'](_0x449892['shift']());}};_0x3cde6a(++_0x2a2cb7);}(_0x9cf4,0x16d));var _0x49cf=function(_0x20d80c,_0x57f4bc){_0x20d80c=_0x20d80c-0x0;var _0x39ff0a=_0x9cf4[_0x20d80c];return _0x39ff0a;};'use strict';var _=require(_0x49cf('0x0'));var util=require(_0x49cf('0x1'));var moment=require(_0x49cf('0x2'));var BPromise=require(_0x49cf('0x3'));var rs=require(_0x49cf('0x4'));var fs=require('fs');var Redis=require(_0x49cf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x49cf('0x6'));var logger=require(_0x49cf('0x7'))('rpc');var config=require(_0x49cf('0x8'));var jayson=require(_0x49cf('0x9'));var client=jayson['client'][_0x49cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31750e,_0x2e296d,_0x3b61ed){return new BPromise(function(_0x3f03c6,_0x3081d2){return client[_0x49cf('0xb')](_0x31750e,_0x3b61ed)['then'](function(_0x3e73c0){logger[_0x49cf('0xc')](_0x49cf('0xd'),_0x2e296d,_0x49cf('0xe'));logger[_0x49cf('0xf')](_0x49cf('0x10'),_0x2e296d,'request\x20sent',JSON[_0x49cf('0x11')](_0x3e73c0));if(_0x3e73c0[_0x49cf('0x12')]){if(_0x3e73c0[_0x49cf('0x12')]['code']===0x1f4){logger[_0x49cf('0x12')]('ZohoField,\x20%s,\x20%s',_0x2e296d,_0x3e73c0['error'][_0x49cf('0x13')]);return _0x3081d2(_0x3e73c0[_0x49cf('0x12')][_0x49cf('0x13')]);}logger['error'](_0x49cf('0xd'),_0x2e296d,_0x3e73c0[_0x49cf('0x12')][_0x49cf('0x13')]);return _0x3f03c6(_0x3e73c0[_0x49cf('0x12')][_0x49cf('0x13')]);}else{logger[_0x49cf('0xc')](_0x49cf('0xd'),_0x2e296d,_0x49cf('0xe'));_0x3f03c6(_0x3e73c0[_0x49cf('0x14')][_0x49cf('0x13')]);}})[_0x49cf('0x15')](function(_0x3c4c1c){logger[_0x49cf('0x12')](_0x49cf('0xd'),_0x2e296d,_0x3c4c1c);_0x3081d2(_0x3c4c1c);});});}