Built motion from commit da617fac.|2.6.6
[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 _0x69af=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','util'];(function(_0x2d8d69,_0x8e47ff){var _0x39ae22=function(_0xd7935e){while(--_0xd7935e){_0x2d8d69['push'](_0x2d8d69['shift']());}};_0x39ae22(++_0x8e47ff);}(_0x69af,0x17b));var _0xf69a=function(_0x4f6db1,_0x25745f){_0x4f6db1=_0x4f6db1-0x0;var _0x14fd09=_0x69af[_0x4f6db1];return _0x14fd09;};'use strict';var _=require('lodash');var util=require(_0xf69a('0x0'));var moment=require(_0xf69a('0x1'));var BPromise=require(_0xf69a('0x2'));var rs=require(_0xf69a('0x3'));var fs=require('fs');var Redis=require(_0xf69a('0x4'));var db=require(_0xf69a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf69a('0x6'))(_0xf69a('0x7'));var config=require(_0xf69a('0x8'));var jayson=require(_0xf69a('0x9'));var client=jayson[_0xf69a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10c1b0,_0x3669ef,_0xb0233d){return new BPromise(function(_0x4ffe11,_0x4a3496){return client[_0xf69a('0xb')](_0x10c1b0,_0xb0233d)[_0xf69a('0xc')](function(_0x16a06e){logger[_0xf69a('0xd')](_0xf69a('0xe'),_0x3669ef,'request\x20sent');logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x3669ef,_0xf69a('0xf'),JSON[_0xf69a('0x10')](_0x16a06e));if(_0x16a06e[_0xf69a('0x11')]){if(_0x16a06e[_0xf69a('0x11')]['code']===0x1f4){logger[_0xf69a('0x11')](_0xf69a('0xe'),_0x3669ef,_0x16a06e[_0xf69a('0x11')][_0xf69a('0x12')]);return _0x4a3496(_0x16a06e[_0xf69a('0x11')][_0xf69a('0x12')]);}logger[_0xf69a('0x11')](_0xf69a('0xe'),_0x3669ef,_0x16a06e[_0xf69a('0x11')][_0xf69a('0x12')]);return _0x4ffe11(_0x16a06e['error'][_0xf69a('0x12')]);}else{logger[_0xf69a('0xd')](_0xf69a('0xe'),_0x3669ef,_0xf69a('0xf'));_0x4ffe11(_0x16a06e['result'][_0xf69a('0x12')]);}})[_0xf69a('0x13')](function(_0x17660b){logger[_0xf69a('0x11')](_0xf69a('0xe'),_0x3669ef,_0x17660b);_0x4a3496(_0x17660b);});});}