Built motion from commit 3e059bc2.|2.5.32
[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 _0xe978=['ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','ZendeskField,\x20%s,\x20%s','debug'];(function(_0x317fba,_0x5b5b38){var _0x279bc7=function(_0xd4e6d9){while(--_0xd4e6d9){_0x317fba['push'](_0x317fba['shift']());}};_0x279bc7(++_0x5b5b38);}(_0xe978,0xa8));var _0x8e97=function(_0x26c99c,_0xd6bd90){_0x26c99c=_0x26c99c-0x0;var _0x5f102f=_0xe978[_0x26c99c];return _0x5f102f;};'use strict';var _=require('lodash');var util=require(_0x8e97('0x0'));var moment=require(_0x8e97('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e97('0x2'));var db=require(_0x8e97('0x3'))['db'];var utils=require(_0x8e97('0x4'));var logger=require('../../config/logger')(_0x8e97('0x5'));var config=require(_0x8e97('0x6'));var jayson=require(_0x8e97('0x7'));var client=jayson[_0x8e97('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x155e79,_0x2dc504,_0x6edea7){return new BPromise(function(_0x5a8f8e,_0x57b49b){return client['request'](_0x155e79,_0x6edea7)[_0x8e97('0x9')](function(_0x24b864){logger['info'](_0x8e97('0xa'),_0x2dc504,'request\x20sent');logger[_0x8e97('0xb')](_0x8e97('0xc'),_0x2dc504,_0x8e97('0xd'),JSON[_0x8e97('0xe')](_0x24b864));if(_0x24b864[_0x8e97('0xf')]){if(_0x24b864[_0x8e97('0xf')]['code']===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x2dc504,_0x24b864[_0x8e97('0xf')][_0x8e97('0x10')]);return _0x57b49b(_0x24b864['error']['message']);}logger[_0x8e97('0xf')](_0x8e97('0xa'),_0x2dc504,_0x24b864[_0x8e97('0xf')][_0x8e97('0x10')]);return _0x5a8f8e(_0x24b864[_0x8e97('0xf')]['message']);}else{logger[_0x8e97('0x11')](_0x8e97('0xa'),_0x2dc504,_0x8e97('0xd'));_0x5a8f8e(_0x24b864[_0x8e97('0x12')][_0x8e97('0x10')]);}})[_0x8e97('0x13')](function(_0x20838c){logger[_0x8e97('0xf')](_0x8e97('0xa'),_0x2dc504,_0x20838c);_0x57b49b(_0x20838c);});});}