08f6f30dbc176ebd857d53157f7f914507641d5c
[motion2.git] / server / api / saInvoice / saInvoice.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 _0x02d0=['SAInvoice,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','SAInvoice,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x196f40,_0x417e6e){var _0x544d7b=function(_0x46c19c){while(--_0x46c19c){_0x196f40['push'](_0x196f40['shift']());}};_0x544d7b(++_0x417e6e);}(_0x02d0,0x100));var _0x002d=function(_0xce5f73,_0x5907a8){_0xce5f73=_0xce5f73-0x0;var _0x591481=_0x02d0[_0xce5f73];return _0x591481;};'use strict';var _=require(_0x002d('0x0'));var util=require(_0x002d('0x1'));var moment=require('moment');var BPromise=require(_0x002d('0x2'));var rs=require(_0x002d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x002d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x002d('0x5'))('rpc');var config=require(_0x002d('0x6'));var jayson=require(_0x002d('0x7'));var client=jayson[_0x002d('0x8')][_0x002d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fecbf,_0x2e9df2,_0x53b9c3){return new BPromise(function(_0x549504,_0x135d58){return client['request'](_0x4fecbf,_0x53b9c3)[_0x002d('0xa')](function(_0x5bd463){logger[_0x002d('0xb')]('SAInvoice,\x20%s,\x20%s',_0x2e9df2,_0x002d('0xc'));logger['debug'](_0x002d('0xd'),_0x2e9df2,_0x002d('0xc'),JSON[_0x002d('0xe')](_0x5bd463));if(_0x5bd463[_0x002d('0xf')]){if(_0x5bd463[_0x002d('0xf')][_0x002d('0x10')]===0x1f4){logger[_0x002d('0xf')](_0x002d('0x11'),_0x2e9df2,_0x5bd463[_0x002d('0xf')][_0x002d('0x12')]);return _0x135d58(_0x5bd463[_0x002d('0xf')][_0x002d('0x12')]);}logger['error'](_0x002d('0x11'),_0x2e9df2,_0x5bd463[_0x002d('0xf')][_0x002d('0x12')]);return _0x549504(_0x5bd463['error']['message']);}else{logger[_0x002d('0xb')]('SAInvoice,\x20%s,\x20%s',_0x2e9df2,_0x002d('0xc'));_0x549504(_0x5bd463[_0x002d('0x13')][_0x002d('0x12')]);}})[_0x002d('0x14')](function(_0x43ccc5){logger[_0x002d('0xf')](_0x002d('0x11'),_0x2e9df2,_0x43ccc5);_0x135d58(_0x43ccc5);});});}