c6049bdff6e8f13e49727d1b0e68bef97bb9cbdb
[motion2.git] / server / api / intFreshdeskField / intFreshdeskField.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 _0x4bc6=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird'];(function(_0x48fa41,_0x511025){var _0x1eaa99=function(_0x549e85){while(--_0x549e85){_0x48fa41['push'](_0x48fa41['shift']());}};_0x1eaa99(++_0x511025);}(_0x4bc6,0xe3));var _0x64bc=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x4bc6[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x64bc('0x0'));var util=require('util');var moment=require(_0x64bc('0x1'));var BPromise=require(_0x64bc('0x2'));var rs=require(_0x64bc('0x3'));var fs=require('fs');var Redis=require(_0x64bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x64bc('0x5'));var logger=require(_0x64bc('0x6'))(_0x64bc('0x7'));var config=require(_0x64bc('0x8'));var jayson=require(_0x64bc('0x9'));var client=jayson[_0x64bc('0xa')][_0x64bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5115f7,_0x2621d9,_0xbe1233){return new BPromise(function(_0x55ad22,_0x4687a6){return client[_0x64bc('0xc')](_0x5115f7,_0xbe1233)[_0x64bc('0xd')](function(_0x314d84){logger[_0x64bc('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x2621d9,_0x64bc('0xf'));logger['debug'](_0x64bc('0x10'),_0x2621d9,_0x64bc('0xf'),JSON[_0x64bc('0x11')](_0x314d84));if(_0x314d84[_0x64bc('0x12')]){if(_0x314d84[_0x64bc('0x12')]['code']===0x1f4){logger[_0x64bc('0x12')](_0x64bc('0x13'),_0x2621d9,_0x314d84[_0x64bc('0x12')][_0x64bc('0x14')]);return _0x4687a6(_0x314d84[_0x64bc('0x12')][_0x64bc('0x14')]);}logger['error'](_0x64bc('0x13'),_0x2621d9,_0x314d84[_0x64bc('0x12')][_0x64bc('0x14')]);return _0x55ad22(_0x314d84['error'][_0x64bc('0x14')]);}else{logger[_0x64bc('0xe')](_0x64bc('0x13'),_0x2621d9,'request\x20sent');_0x55ad22(_0x314d84[_0x64bc('0x15')][_0x64bc('0x14')]);}})[_0x64bc('0x16')](function(_0x424851){logger[_0x64bc('0x12')](_0x64bc('0x13'),_0x2621d9,_0x424851);_0x4687a6(_0x424851);});});}