Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / api / intZendeskField / intZendeskField.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 _0x6442=['catch','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','ZendeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x2fc9bd,_0x2d5cf2){var _0x565c7d=function(_0xaa1074){while(--_0xaa1074){_0x2fc9bd['push'](_0x2fc9bd['shift']());}};_0x565c7d(++_0x2d5cf2);}(_0x6442,0x1f1));var _0x2644=function(_0x3510c2,_0x396bf6){_0x3510c2=_0x3510c2-0x0;var _0x191fb0=_0x6442[_0x3510c2];return _0x191fb0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2644('0x0'));var db=require('../../mysqldb')['db'];var utils=require(_0x2644('0x1'));var logger=require(_0x2644('0x2'))('rpc');var config=require(_0x2644('0x3'));var jayson=require(_0x2644('0x4'));var client=jayson[_0x2644('0x5')][_0x2644('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x303db9,_0x4a4677,_0x1b4c62){return new BPromise(function(_0x353d76,_0x578c08){return client['request'](_0x303db9,_0x1b4c62)['then'](function(_0x4b732f){logger[_0x2644('0x7')](_0x2644('0x8'),_0x4a4677,_0x2644('0x9'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4a4677,'request\x20sent',JSON[_0x2644('0xa')](_0x4b732f));if(_0x4b732f[_0x2644('0xb')]){if(_0x4b732f[_0x2644('0xb')][_0x2644('0xc')]===0x1f4){logger[_0x2644('0xb')](_0x2644('0x8'),_0x4a4677,_0x4b732f[_0x2644('0xb')][_0x2644('0xd')]);return _0x578c08(_0x4b732f['error']['message']);}logger[_0x2644('0xb')](_0x2644('0x8'),_0x4a4677,_0x4b732f[_0x2644('0xb')][_0x2644('0xd')]);return _0x353d76(_0x4b732f['error'][_0x2644('0xd')]);}else{logger[_0x2644('0x7')](_0x2644('0x8'),_0x4a4677,_0x2644('0x9'));_0x353d76(_0x4b732f[_0x2644('0xe')][_0x2644('0xd')]);}})[_0x2644('0xf')](function(_0x2564b6){logger['error'](_0x2644('0x8'),_0x4a4677,_0x2564b6);_0x578c08(_0x2564b6);});});}