Built motion from commit e1760111.|2.6.18
[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 _0x69a3=['error','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x69a3,0xc9));var _0x369a=function(_0x2c719c,_0x288719){_0x2c719c=_0x2c719c-0x0;var _0x54e68c=_0x69a3[_0x2c719c];return _0x54e68c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x369a('0x0'));var BPromise=require(_0x369a('0x1'));var rs=require(_0x369a('0x2'));var fs=require('fs');var Redis=require(_0x369a('0x3'));var db=require(_0x369a('0x4'))['db'];var utils=require(_0x369a('0x5'));var logger=require(_0x369a('0x6'))(_0x369a('0x7'));var config=require(_0x369a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x369a('0x9')][_0x369a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f82ad,_0x157b38,_0x3763c1){return new BPromise(function(_0x31fa89,_0x15afa4){return client[_0x369a('0xb')](_0x4f82ad,_0x3763c1)[_0x369a('0xc')](function(_0x3b8fd7){logger[_0x369a('0xd')](_0x369a('0xe'),_0x157b38,_0x369a('0xf'));logger[_0x369a('0x10')](_0x369a('0x11'),_0x157b38,'request\x20sent',JSON[_0x369a('0x12')](_0x3b8fd7));if(_0x3b8fd7[_0x369a('0x13')]){if(_0x3b8fd7[_0x369a('0x13')]['code']===0x1f4){logger[_0x369a('0x13')](_0x369a('0xe'),_0x157b38,_0x3b8fd7[_0x369a('0x13')][_0x369a('0x14')]);return _0x15afa4(_0x3b8fd7[_0x369a('0x13')][_0x369a('0x14')]);}logger[_0x369a('0x13')](_0x369a('0xe'),_0x157b38,_0x3b8fd7[_0x369a('0x13')][_0x369a('0x14')]);return _0x31fa89(_0x3b8fd7[_0x369a('0x13')][_0x369a('0x14')]);}else{logger[_0x369a('0xd')](_0x369a('0xe'),_0x157b38,_0x369a('0xf'));_0x31fa89(_0x3b8fd7[_0x369a('0x15')][_0x369a('0x14')]);}})['catch'](function(_0x8e6f05){logger['error'](_0x369a('0xe'),_0x157b38,_0x8e6f05);_0x15afa4(_0x8e6f05);});});}