Built motion from commit (unavailable).|2.4.3
[motion2.git] / server / api / saCreditNote / saCreditNote.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 _0xeba2=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','SACreditNote,\x20%s,\x20%s','request\x20sent','debug','SACreditNote,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5a6de2,_0x5c8b10){var _0x2c0525=function(_0x59d072){while(--_0x59d072){_0x5a6de2['push'](_0x5a6de2['shift']());}};_0x2c0525(++_0x5c8b10);}(_0xeba2,0x70));var _0x2eba=function(_0x10d8c7,_0xa80d12){_0x10d8c7=_0x10d8c7-0x0;var _0x4105b9=_0xeba2[_0x10d8c7];return _0x4105b9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2eba('0x0'));var BPromise=require(_0x2eba('0x1'));var rs=require(_0x2eba('0x2'));var fs=require('fs');var Redis=require(_0x2eba('0x3'));var db=require(_0x2eba('0x4'))['db'];var utils=require(_0x2eba('0x5'));var logger=require(_0x2eba('0x6'))(_0x2eba('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2eba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b4d9a,_0x14c40a,_0x4e7a50){return new BPromise(function(_0x279806,_0x1fed79){return client[_0x2eba('0x9')](_0x1b4d9a,_0x4e7a50)[_0x2eba('0xa')](function(_0x1cc4e){logger[_0x2eba('0xb')](_0x2eba('0xc'),_0x14c40a,_0x2eba('0xd'));logger[_0x2eba('0xe')](_0x2eba('0xf'),_0x14c40a,'request\x20sent',JSON[_0x2eba('0x10')](_0x1cc4e));if(_0x1cc4e[_0x2eba('0x11')]){if(_0x1cc4e['error'][_0x2eba('0x12')]===0x1f4){logger[_0x2eba('0x11')](_0x2eba('0xc'),_0x14c40a,_0x1cc4e[_0x2eba('0x11')][_0x2eba('0x13')]);return _0x1fed79(_0x1cc4e[_0x2eba('0x11')][_0x2eba('0x13')]);}logger['error']('SACreditNote,\x20%s,\x20%s',_0x14c40a,_0x1cc4e[_0x2eba('0x11')][_0x2eba('0x13')]);return _0x279806(_0x1cc4e[_0x2eba('0x11')][_0x2eba('0x13')]);}else{logger[_0x2eba('0xb')]('SACreditNote,\x20%s,\x20%s',_0x14c40a,_0x2eba('0xd'));_0x279806(_0x1cc4e[_0x2eba('0x14')][_0x2eba('0x13')]);}})[_0x2eba('0x15')](function(_0x2de66e){logger['error'](_0x2eba('0xc'),_0x14c40a,_0x2de66e);_0x1fed79(_0x2de66e);});});}