c33d1149b1fe77c2eb1967eadac90555447740ce
[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 _0x398a=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s'];(function(_0x295d4f,_0x5980ec){var _0xe830df=function(_0x2c70b9){while(--_0x2c70b9){_0x295d4f['push'](_0x295d4f['shift']());}};_0xe830df(++_0x5980ec);}(_0x398a,0x11a));var _0xa398=function(_0x1c851b,_0x2d9d8c){_0x1c851b=_0x1c851b-0x0;var _0x418b14=_0x398a[_0x1c851b];return _0x418b14;};'use strict';var _=require(_0xa398('0x0'));var util=require(_0xa398('0x1'));var moment=require(_0xa398('0x2'));var BPromise=require(_0xa398('0x3'));var rs=require(_0xa398('0x4'));var fs=require('fs');var Redis=require(_0xa398('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa398('0x6'));var config=require(_0xa398('0x7'));var jayson=require(_0xa398('0x8'));var client=jayson[_0xa398('0x9')][_0xa398('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ac561,_0x1fa6cb,_0x24e456){return new BPromise(function(_0x468a9d,_0x2e26f0){return client['request'](_0x2ac561,_0x24e456)[_0xa398('0xb')](function(_0x3c7f25){logger[_0xa398('0xc')](_0xa398('0xd'),_0x1fa6cb,_0xa398('0xe'));logger[_0xa398('0xf')](_0xa398('0x10'),_0x1fa6cb,'request\x20sent',JSON[_0xa398('0x11')](_0x3c7f25));if(_0x3c7f25[_0xa398('0x12')]){if(_0x3c7f25[_0xa398('0x12')][_0xa398('0x13')]===0x1f4){logger[_0xa398('0x12')](_0xa398('0xd'),_0x1fa6cb,_0x3c7f25[_0xa398('0x12')][_0xa398('0x14')]);return _0x2e26f0(_0x3c7f25['error'][_0xa398('0x14')]);}logger[_0xa398('0x12')](_0xa398('0xd'),_0x1fa6cb,_0x3c7f25[_0xa398('0x12')][_0xa398('0x14')]);return _0x468a9d(_0x3c7f25[_0xa398('0x12')][_0xa398('0x14')]);}else{logger[_0xa398('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x1fa6cb,_0xa398('0xe'));_0x468a9d(_0x3c7f25[_0xa398('0x15')]['message']);}})[_0xa398('0x16')](function(_0x42a001){logger[_0xa398('0x12')](_0xa398('0xd'),_0x1fa6cb,_0x42a001);_0x2e26f0(_0x42a001);});});}