1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
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. *
17 // *************************************************************************
18 var _0x3842=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash'];(function(_0x5d3676,_0x24edeb){var _0x504f5b=function(_0x5ab2b4){while(--_0x5ab2b4){_0x5d3676['push'](_0x5d3676['shift']());}};_0x504f5b(++_0x24edeb);}(_0x3842,0x16f));var _0x2384=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3842[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x2384('0x0'));var util=require(_0x2384('0x1'));var moment=require(_0x2384('0x2'));var BPromise=require(_0x2384('0x3'));var rs=require(_0x2384('0x4'));var fs=require('fs');var Redis=require(_0x2384('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2384('0x6'));var logger=require(_0x2384('0x7'))('rpc');var config=require(_0x2384('0x8'));var jayson=require(_0x2384('0x9'));var client=jayson[_0x2384('0xa')][_0x2384('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ef2af,_0x2c9618,_0x5b6d16){return new BPromise(function(_0xe8f519,_0x112255){return client[_0x2384('0xc')](_0x4ef2af,_0x5b6d16)[_0x2384('0xd')](function(_0x420613){logger[_0x2384('0xe')](_0x2384('0xf'),_0x2c9618,'request\x20sent');logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x2c9618,'request\x20sent',JSON[_0x2384('0x10')](_0x420613));if(_0x420613[_0x2384('0x11')]){if(_0x420613['error'][_0x2384('0x12')]===0x1f4){logger[_0x2384('0x11')]('SalesforceField,\x20%s,\x20%s',_0x2c9618,_0x420613[_0x2384('0x11')]['message']);return _0x112255(_0x420613[_0x2384('0x11')][_0x2384('0x13')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x2c9618,_0x420613['error'][_0x2384('0x13')]);return _0xe8f519(_0x420613[_0x2384('0x11')]['message']);}else{logger[_0x2384('0xe')](_0x2384('0xf'),_0x2c9618,_0x2384('0x14'));_0xe8f519(_0x420613[_0x2384('0x15')][_0x2384('0x13')]);}})[_0x2384('0x16')](function(_0x1816aa){logger[_0x2384('0x11')](_0x2384('0xf'),_0x2c9618,_0x1816aa);_0x112255(_0x1816aa);});});}