a29fc9e59daef180871306d1308bbde70aeba0ca
[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 _0x13f8=['jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x472301,_0xcfe74b){var _0x1fb2da=function(_0x19416d){while(--_0x19416d){_0x472301['push'](_0x472301['shift']());}};_0x1fb2da(++_0xcfe74b);}(_0x13f8,0x19c));var _0x813f=function(_0x348bdb,_0x41f11d){_0x348bdb=_0x348bdb-0x0;var _0x4480f9=_0x13f8[_0x348bdb];return _0x4480f9;};'use strict';var _=require(_0x813f('0x0'));var util=require(_0x813f('0x1'));var moment=require(_0x813f('0x2'));var BPromise=require('bluebird');var rs=require(_0x813f('0x3'));var fs=require('fs');var Redis=require(_0x813f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x813f('0x5'));var logger=require('../../config/logger')(_0x813f('0x6'));var config=require(_0x813f('0x7'));var jayson=require(_0x813f('0x8'));var client=jayson[_0x813f('0x9')][_0x813f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fe4b3,_0x3225b2,_0x57f578){return new BPromise(function(_0x2db727,_0x7ffd3d){return client['request'](_0x2fe4b3,_0x57f578)[_0x813f('0xb')](function(_0x41c3bf){logger[_0x813f('0xc')](_0x813f('0xd'),_0x3225b2,_0x813f('0xe'));logger['debug'](_0x813f('0xf'),_0x3225b2,'request\x20sent',JSON[_0x813f('0x10')](_0x41c3bf));if(_0x41c3bf[_0x813f('0x11')]){if(_0x41c3bf[_0x813f('0x11')]['code']===0x1f4){logger[_0x813f('0x11')](_0x813f('0xd'),_0x3225b2,_0x41c3bf[_0x813f('0x11')][_0x813f('0x12')]);return _0x7ffd3d(_0x41c3bf['error']['message']);}logger[_0x813f('0x11')](_0x813f('0xd'),_0x3225b2,_0x41c3bf[_0x813f('0x11')]['message']);return _0x2db727(_0x41c3bf[_0x813f('0x11')][_0x813f('0x12')]);}else{logger[_0x813f('0xc')](_0x813f('0xd'),_0x3225b2,'request\x20sent');_0x2db727(_0x41c3bf[_0x813f('0x13')][_0x813f('0x12')]);}})[_0x813f('0x14')](function(_0x19620e){logger[_0x813f('0x11')](_0x813f('0xd'),_0x3225b2,_0x19620e);_0x7ffd3d(_0x19620e);});});}