844add28e2650ff91bbf78f2f7033efa712ca3dc
[motion2.git] / server / api / saQuotation / saQuotation.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 _0x70f6=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SAQuotation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util'];(function(_0x23cbb4,_0x357380){var _0x4a9dcf=function(_0x593922){while(--_0x593922){_0x23cbb4['push'](_0x23cbb4['shift']());}};_0x4a9dcf(++_0x357380);}(_0x70f6,0x97));var _0x670f=function(_0x3b247d,_0xbe4218){_0x3b247d=_0x3b247d-0x0;var _0x131bcf=_0x70f6[_0x3b247d];return _0x131bcf;};'use strict';var _=require('lodash');var util=require(_0x670f('0x0'));var moment=require(_0x670f('0x1'));var BPromise=require(_0x670f('0x2'));var rs=require(_0x670f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x670f('0x4'))['db'];var utils=require(_0x670f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x670f('0x6'));var jayson=require(_0x670f('0x7'));var client=jayson[_0x670f('0x8')][_0x670f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x235c9d,_0x11bb55,_0x142f02){return new BPromise(function(_0x4f691e,_0x2a349a){return client['request'](_0x235c9d,_0x142f02)[_0x670f('0xa')](function(_0x1a373f){logger[_0x670f('0xb')](_0x670f('0xc'),_0x11bb55,_0x670f('0xd'));logger[_0x670f('0xe')]('SAQuotation,\x20%s,\x20%s,\x20%s',_0x11bb55,_0x670f('0xd'),JSON[_0x670f('0xf')](_0x1a373f));if(_0x1a373f[_0x670f('0x10')]){if(_0x1a373f[_0x670f('0x10')]['code']===0x1f4){logger[_0x670f('0x10')]('SAQuotation,\x20%s,\x20%s',_0x11bb55,_0x1a373f[_0x670f('0x10')][_0x670f('0x11')]);return _0x2a349a(_0x1a373f[_0x670f('0x10')][_0x670f('0x11')]);}logger['error'](_0x670f('0xc'),_0x11bb55,_0x1a373f[_0x670f('0x10')][_0x670f('0x11')]);return _0x4f691e(_0x1a373f['error'][_0x670f('0x11')]);}else{logger[_0x670f('0xb')](_0x670f('0xc'),_0x11bb55,_0x670f('0xd'));_0x4f691e(_0x1a373f[_0x670f('0x12')]['message']);}})['catch'](function(_0x5965a1){logger[_0x670f('0x10')](_0x670f('0xc'),_0x11bb55,_0x5965a1);_0x2a349a(_0x5965a1);});});}