Built motion from commit 5ad77b03.|2.6.3
[motion2.git] / server / api / intZohoField / intZohoField.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 _0x9f21=['ZohoField,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','ZohoField,\x20%s,\x20%s','request\x20sent'];(function(_0x368244,_0x183e0b){var _0x1933c6=function(_0x4cfa0e){while(--_0x4cfa0e){_0x368244['push'](_0x368244['shift']());}};_0x1933c6(++_0x183e0b);}(_0x9f21,0xdc));var _0x19f2=function(_0x1a32fe,_0xdab6ac){_0x1a32fe=_0x1a32fe-0x0;var _0x1abca6=_0x9f21[_0x1a32fe];return _0x1abca6;};'use strict';var _=require(_0x19f2('0x0'));var util=require(_0x19f2('0x1'));var moment=require(_0x19f2('0x2'));var BPromise=require('bluebird');var rs=require(_0x19f2('0x3'));var fs=require('fs');var Redis=require(_0x19f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x19f2('0x5'));var logger=require(_0x19f2('0x6'))(_0x19f2('0x7'));var config=require(_0x19f2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x19f2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x281de3,_0x164852,_0x47b54f){return new BPromise(function(_0x391c73,_0x396e5c){return client['request'](_0x281de3,_0x47b54f)[_0x19f2('0xa')](function(_0x5ea844){logger[_0x19f2('0xb')](_0x19f2('0xc'),_0x164852,_0x19f2('0xd'));logger['debug'](_0x19f2('0xe'),_0x164852,_0x19f2('0xd'),JSON['stringify'](_0x5ea844));if(_0x5ea844[_0x19f2('0xf')]){if(_0x5ea844['error']['code']===0x1f4){logger[_0x19f2('0xf')](_0x19f2('0xc'),_0x164852,_0x5ea844[_0x19f2('0xf')][_0x19f2('0x10')]);return _0x396e5c(_0x5ea844[_0x19f2('0xf')][_0x19f2('0x10')]);}logger['error'](_0x19f2('0xc'),_0x164852,_0x5ea844[_0x19f2('0xf')][_0x19f2('0x10')]);return _0x391c73(_0x5ea844[_0x19f2('0xf')][_0x19f2('0x10')]);}else{logger[_0x19f2('0xb')](_0x19f2('0xc'),_0x164852,_0x19f2('0xd'));_0x391c73(_0x5ea844['result'][_0x19f2('0x10')]);}})[_0x19f2('0x11')](function(_0x236112){logger[_0x19f2('0xf')](_0x19f2('0xc'),_0x164852,_0x236112);_0x396e5c(_0x236112);});});}