5849bbaf296df883f88b540b9995051ccd72c19c
[motion2.git] / server / api / intSalesforceField / intSalesforceField.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 _0x32f6=['http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x32f6,0x182));var _0x632f=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x32f6[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x632f('0x0'));var util=require('util');var moment=require(_0x632f('0x1'));var BPromise=require(_0x632f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x632f('0x3'));var db=require(_0x632f('0x4'))['db'];var utils=require(_0x632f('0x5'));var logger=require(_0x632f('0x6'))(_0x632f('0x7'));var config=require(_0x632f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x632f('0x9')][_0x632f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15b56a,_0x2a9e9c,_0x41c88a){return new BPromise(function(_0x5bbac7,_0x179c6e){return client[_0x632f('0xb')](_0x15b56a,_0x41c88a)['then'](function(_0x3065b8){logger[_0x632f('0xc')](_0x632f('0xd'),_0x2a9e9c,_0x632f('0xe'));logger[_0x632f('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x2a9e9c,_0x632f('0xe'),JSON[_0x632f('0x10')](_0x3065b8));if(_0x3065b8[_0x632f('0x11')]){if(_0x3065b8[_0x632f('0x11')][_0x632f('0x12')]===0x1f4){logger[_0x632f('0x11')]('SalesforceField,\x20%s,\x20%s',_0x2a9e9c,_0x3065b8[_0x632f('0x11')][_0x632f('0x13')]);return _0x179c6e(_0x3065b8['error']['message']);}logger[_0x632f('0x11')](_0x632f('0xd'),_0x2a9e9c,_0x3065b8[_0x632f('0x11')][_0x632f('0x13')]);return _0x5bbac7(_0x3065b8[_0x632f('0x11')][_0x632f('0x13')]);}else{logger[_0x632f('0xc')](_0x632f('0xd'),_0x2a9e9c,_0x632f('0xe'));_0x5bbac7(_0x3065b8[_0x632f('0x14')][_0x632f('0x13')]);}})[_0x632f('0x15')](function(_0x20aedd){logger[_0x632f('0x11')](_0x632f('0xd'),_0x2a9e9c,_0x20aedd);_0x179c6e(_0x20aedd);});});}