Built motion from commit (unavailable).|2.5.3
[motion2.git] / server / api / whatsappApplication / whatsappApplication.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 _0x2e88=['then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x2e88,0x95));var _0x82e8=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x2e88[_0x2ae2ad];return _0x26dbd7;};'use strict';var _=require(_0x82e8('0x0'));var util=require(_0x82e8('0x1'));var moment=require(_0x82e8('0x2'));var BPromise=require(_0x82e8('0x3'));var rs=require(_0x82e8('0x4'));var fs=require('fs');var Redis=require(_0x82e8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x82e8('0x6'));var logger=require(_0x82e8('0x7'))('rpc');var config=require(_0x82e8('0x8'));var jayson=require(_0x82e8('0x9'));var client=jayson['client'][_0x82e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e2496,_0x3db496,_0x27df44){return new BPromise(function(_0x393c2c,_0x1ecc8f){return client[_0x82e8('0xb')](_0x1e2496,_0x27df44)[_0x82e8('0xc')](function(_0x80019f){logger[_0x82e8('0xd')](_0x82e8('0xe'),_0x3db496,'request\x20sent');logger[_0x82e8('0xf')](_0x82e8('0x10'),_0x3db496,_0x82e8('0x11'),JSON[_0x82e8('0x12')](_0x80019f));if(_0x80019f[_0x82e8('0x13')]){if(_0x80019f[_0x82e8('0x13')][_0x82e8('0x14')]===0x1f4){logger['error'](_0x82e8('0xe'),_0x3db496,_0x80019f[_0x82e8('0x13')][_0x82e8('0x15')]);return _0x1ecc8f(_0x80019f[_0x82e8('0x13')][_0x82e8('0x15')]);}logger['error'](_0x82e8('0xe'),_0x3db496,_0x80019f[_0x82e8('0x13')][_0x82e8('0x15')]);return _0x393c2c(_0x80019f[_0x82e8('0x13')]['message']);}else{logger[_0x82e8('0xd')](_0x82e8('0xe'),_0x3db496,_0x82e8('0x11'));_0x393c2c(_0x80019f[_0x82e8('0x16')][_0x82e8('0x15')]);}})['catch'](function(_0x39e7bc){logger[_0x82e8('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x3db496,_0x39e7bc);_0x1ecc8f(_0x39e7bc);});});}