Built motion from commit da617fac.|2.6.6
[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 _0xad48=['ioredis','../../config/utils','rpc','../../config/environment','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring'];(function(_0x21abe1,_0x33de53){var _0x59c808=function(_0x502916){while(--_0x502916){_0x21abe1['push'](_0x21abe1['shift']());}};_0x59c808(++_0x33de53);}(_0xad48,0x177));var _0x8ad4=function(_0x2bda10,_0x36b96b){_0x2bda10=_0x2bda10-0x0;var _0x36541f=_0xad48[_0x2bda10];return _0x36541f;};'use strict';var _=require(_0x8ad4('0x0'));var util=require('util');var moment=require(_0x8ad4('0x1'));var BPromise=require('bluebird');var rs=require(_0x8ad4('0x2'));var fs=require('fs');var Redis=require(_0x8ad4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ad4('0x4'));var logger=require('../../config/logger')(_0x8ad4('0x5'));var config=require(_0x8ad4('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8ad4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x438ebc,_0xb16768,_0x396ce4){return new BPromise(function(_0x296d26,_0x499716){return client[_0x8ad4('0x8')](_0x438ebc,_0x396ce4)[_0x8ad4('0x9')](function(_0x4d94c3){logger[_0x8ad4('0xa')](_0x8ad4('0xb'),_0xb16768,_0x8ad4('0xc'));logger[_0x8ad4('0xd')](_0x8ad4('0xe'),_0xb16768,'request\x20sent',JSON[_0x8ad4('0xf')](_0x4d94c3));if(_0x4d94c3[_0x8ad4('0x10')]){if(_0x4d94c3[_0x8ad4('0x10')][_0x8ad4('0x11')]===0x1f4){logger[_0x8ad4('0x10')](_0x8ad4('0xb'),_0xb16768,_0x4d94c3[_0x8ad4('0x10')][_0x8ad4('0x12')]);return _0x499716(_0x4d94c3[_0x8ad4('0x10')][_0x8ad4('0x12')]);}logger['error'](_0x8ad4('0xb'),_0xb16768,_0x4d94c3[_0x8ad4('0x10')]['message']);return _0x296d26(_0x4d94c3[_0x8ad4('0x10')]['message']);}else{logger['info'](_0x8ad4('0xb'),_0xb16768,_0x8ad4('0xc'));_0x296d26(_0x4d94c3[_0x8ad4('0x13')][_0x8ad4('0x12')]);}})[_0x8ad4('0x14')](function(_0xdbdefc){logger[_0x8ad4('0x10')](_0x8ad4('0xb'),_0xb16768,_0xdbdefc);_0x499716(_0xdbdefc);});});}