Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / saOrder / saOrder.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 _0xbf8f=['code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SAOrder,\x20%s,\x20%s','request\x20sent','SAOrder,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x16b6f9,_0x4a8ee3){var _0x44863f=function(_0x1073bc){while(--_0x1073bc){_0x16b6f9['push'](_0x16b6f9['shift']());}};_0x44863f(++_0x4a8ee3);}(_0xbf8f,0xff));var _0xfbf8=function(_0x2cab58,_0x48ac19){_0x2cab58=_0x2cab58-0x0;var _0x5ad70f=_0xbf8f[_0x2cab58];return _0x5ad70f;};'use strict';var _=require(_0xfbf8('0x0'));var util=require('util');var moment=require(_0xfbf8('0x1'));var BPromise=require(_0xfbf8('0x2'));var rs=require(_0xfbf8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfbf8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbf8('0x5'))(_0xfbf8('0x6'));var config=require(_0xfbf8('0x7'));var jayson=require(_0xfbf8('0x8'));var client=jayson['client'][_0xfbf8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c005f,_0x4f0c54,_0x546c74){return new BPromise(function(_0x114cf3,_0x663386){return client[_0xfbf8('0xa')](_0x5c005f,_0x546c74)[_0xfbf8('0xb')](function(_0x19e578){logger[_0xfbf8('0xc')](_0xfbf8('0xd'),_0x4f0c54,_0xfbf8('0xe'));logger['debug'](_0xfbf8('0xf'),_0x4f0c54,_0xfbf8('0xe'),JSON[_0xfbf8('0x10')](_0x19e578));if(_0x19e578['error']){if(_0x19e578[_0xfbf8('0x11')][_0xfbf8('0x12')]===0x1f4){logger[_0xfbf8('0x11')]('SAOrder,\x20%s,\x20%s',_0x4f0c54,_0x19e578[_0xfbf8('0x11')][_0xfbf8('0x13')]);return _0x663386(_0x19e578[_0xfbf8('0x11')][_0xfbf8('0x13')]);}logger[_0xfbf8('0x11')](_0xfbf8('0xd'),_0x4f0c54,_0x19e578[_0xfbf8('0x11')][_0xfbf8('0x13')]);return _0x114cf3(_0x19e578[_0xfbf8('0x11')][_0xfbf8('0x13')]);}else{logger[_0xfbf8('0xc')](_0xfbf8('0xd'),_0x4f0c54,'request\x20sent');_0x114cf3(_0x19e578[_0xfbf8('0x14')][_0xfbf8('0x13')]);}})['catch'](function(_0x486ef4){logger[_0xfbf8('0x11')]('SAOrder,\x20%s,\x20%s',_0x4f0c54,_0x486ef4);_0x663386(_0x486ef4);});});}