Built motion from commit eddce310.|2.6.12
[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 _0x5ab5=['http','request','then','info','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5ab5,0x1d9));var _0x55ab=function(_0x10f82a,_0x32ad47){_0x10f82a=_0x10f82a-0x0;var _0xc6077e=_0x5ab5[_0x10f82a];return _0xc6077e;};'use strict';var _=require('lodash');var util=require(_0x55ab('0x0'));var moment=require('moment');var BPromise=require(_0x55ab('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x55ab('0x2'));var db=require(_0x55ab('0x3'))['db'];var utils=require(_0x55ab('0x4'));var logger=require(_0x55ab('0x5'))(_0x55ab('0x6'));var config=require(_0x55ab('0x7'));var jayson=require(_0x55ab('0x8'));var client=jayson[_0x55ab('0x9')][_0x55ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56b7bb,_0xfceb6c,_0x5c3d66){return new BPromise(function(_0x127538,_0x276217){return client[_0x55ab('0xb')](_0x56b7bb,_0x5c3d66)[_0x55ab('0xc')](function(_0x2e3597){logger[_0x55ab('0xd')](_0x55ab('0xe'),_0xfceb6c,'request\x20sent');logger['debug'](_0x55ab('0xf'),_0xfceb6c,_0x55ab('0x10'),JSON[_0x55ab('0x11')](_0x2e3597));if(_0x2e3597[_0x55ab('0x12')]){if(_0x2e3597[_0x55ab('0x12')]['code']===0x1f4){logger[_0x55ab('0x12')]('ZohoField,\x20%s,\x20%s',_0xfceb6c,_0x2e3597[_0x55ab('0x12')][_0x55ab('0x13')]);return _0x276217(_0x2e3597[_0x55ab('0x12')][_0x55ab('0x13')]);}logger[_0x55ab('0x12')](_0x55ab('0xe'),_0xfceb6c,_0x2e3597[_0x55ab('0x12')][_0x55ab('0x13')]);return _0x127538(_0x2e3597[_0x55ab('0x12')][_0x55ab('0x13')]);}else{logger[_0x55ab('0xd')](_0x55ab('0xe'),_0xfceb6c,'request\x20sent');_0x127538(_0x2e3597['result']['message']);}})[_0x55ab('0x14')](function(_0x4bdac8){logger['error']('ZohoField,\x20%s,\x20%s',_0xfceb6c,_0x4bdac8);_0x276217(_0x4bdac8);});});}