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 _0x0eb5=['SAOrder,\x20%s,\x20%s','request\x20sent','debug','SAOrder,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0x0eb5,0x1ad));var _0x50eb=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0eb5[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x50eb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50eb('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x50eb('0x2'));var logger=require(_0x50eb('0x3'))(_0x50eb('0x4'));var config=require(_0x50eb('0x5'));var jayson=require(_0x50eb('0x6'));var client=jayson[_0x50eb('0x7')][_0x50eb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a4755,_0x4dc981,_0xd6c5b9){return new BPromise(function(_0x45e075,_0x94f414){return client[_0x50eb('0x9')](_0x3a4755,_0xd6c5b9)[_0x50eb('0xa')](function(_0x1258a9){logger[_0x50eb('0xb')](_0x50eb('0xc'),_0x4dc981,_0x50eb('0xd'));logger[_0x50eb('0xe')](_0x50eb('0xf'),_0x4dc981,_0x50eb('0xd'),JSON[_0x50eb('0x10')](_0x1258a9));if(_0x1258a9['error']){if(_0x1258a9['error'][_0x50eb('0x11')]===0x1f4){logger[_0x50eb('0x12')](_0x50eb('0xc'),_0x4dc981,_0x1258a9[_0x50eb('0x12')][_0x50eb('0x13')]);return _0x94f414(_0x1258a9[_0x50eb('0x12')]['message']);}logger[_0x50eb('0x12')](_0x50eb('0xc'),_0x4dc981,_0x1258a9['error']['message']);return _0x45e075(_0x1258a9['error']['message']);}else{logger[_0x50eb('0xb')]('SAOrder,\x20%s,\x20%s',_0x4dc981,_0x50eb('0xd'));_0x45e075(_0x1258a9[_0x50eb('0x14')][_0x50eb('0x13')]);}})['catch'](function(_0x145386){logger[_0x50eb('0x12')]('SAOrder,\x20%s,\x20%s',_0x4dc981,_0x145386);_0x94f414(_0x145386);});});}