13ea1dd5ce61fc09ef3d1014b8aa458d3813b94c
[motion2.git] / server / api / userWhatsappQueue / userWhatsappQueue.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 _0x9a23=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5f0f2c,_0x9817bf){var _0x104e69=function(_0x6915cc){while(--_0x6915cc){_0x5f0f2c['push'](_0x5f0f2c['shift']());}};_0x104e69(++_0x9817bf);}(_0x9a23,0x1dd));var _0x39a2=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x9a23[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x39a2('0x0'));var BPromise=require(_0x39a2('0x1'));var rs=require(_0x39a2('0x2'));var fs=require('fs');var Redis=require(_0x39a2('0x3'));var db=require(_0x39a2('0x4'))['db'];var utils=require(_0x39a2('0x5'));var logger=require(_0x39a2('0x6'))(_0x39a2('0x7'));var config=require(_0x39a2('0x8'));var jayson=require(_0x39a2('0x9'));var client=jayson['client'][_0x39a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16644b,_0x54d71b,_0x5c44ab){return new BPromise(function(_0x1b917e,_0x436cc3){return client[_0x39a2('0xb')](_0x16644b,_0x5c44ab)[_0x39a2('0xc')](function(_0x210d37){logger[_0x39a2('0xd')](_0x39a2('0xe'),_0x54d71b,_0x39a2('0xf'));logger[_0x39a2('0x10')](_0x39a2('0x11'),_0x54d71b,_0x39a2('0xf'),JSON['stringify'](_0x210d37));if(_0x210d37['error']){if(_0x210d37[_0x39a2('0x12')][_0x39a2('0x13')]===0x1f4){logger['error'](_0x39a2('0xe'),_0x54d71b,_0x210d37['error'][_0x39a2('0x14')]);return _0x436cc3(_0x210d37[_0x39a2('0x12')]['message']);}logger[_0x39a2('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x54d71b,_0x210d37['error'][_0x39a2('0x14')]);return _0x1b917e(_0x210d37[_0x39a2('0x12')][_0x39a2('0x14')]);}else{logger[_0x39a2('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x54d71b,_0x39a2('0xf'));_0x1b917e(_0x210d37[_0x39a2('0x15')][_0x39a2('0x14')]);}})[_0x39a2('0x16')](function(_0x4c60e4){logger[_0x39a2('0x12')](_0x39a2('0xe'),_0x54d71b,_0x4c60e4);_0x436cc3(_0x4c60e4);});});}