279b87e9c562e99ef012b4dcd7ff664a7b2bac6b
[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 _0x5643=['error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x33a822,_0x452a30){var _0x337f34=function(_0x1cd833){while(--_0x1cd833){_0x33a822['push'](_0x33a822['shift']());}};_0x337f34(++_0x452a30);}(_0x5643,0xd5));var _0x3564=function(_0x33d15b,_0x64b39c){_0x33d15b=_0x33d15b-0x0;var _0x4cc3ae=_0x5643[_0x33d15b];return _0x4cc3ae;};'use strict';var _=require(_0x3564('0x0'));var util=require(_0x3564('0x1'));var moment=require('moment');var BPromise=require(_0x3564('0x2'));var rs=require(_0x3564('0x3'));var fs=require('fs');var Redis=require(_0x3564('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3564('0x5'));var logger=require(_0x3564('0x6'))(_0x3564('0x7'));var config=require(_0x3564('0x8'));var jayson=require(_0x3564('0x9'));var client=jayson['client'][_0x3564('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x175fca,_0x38ef0a,_0x276e9c){return new BPromise(function(_0x346c49,_0x49d3bb){return client[_0x3564('0xb')](_0x175fca,_0x276e9c)[_0x3564('0xc')](function(_0x5bb9f5){logger['info'](_0x3564('0xd'),_0x38ef0a,_0x3564('0xe'));logger[_0x3564('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x38ef0a,_0x3564('0xe'),JSON[_0x3564('0x10')](_0x5bb9f5));if(_0x5bb9f5['error']){if(_0x5bb9f5[_0x3564('0x11')][_0x3564('0x12')]===0x1f4){logger['error'](_0x3564('0xd'),_0x38ef0a,_0x5bb9f5['error'][_0x3564('0x13')]);return _0x49d3bb(_0x5bb9f5[_0x3564('0x11')][_0x3564('0x13')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x38ef0a,_0x5bb9f5['error']['message']);return _0x346c49(_0x5bb9f5['error'][_0x3564('0x13')]);}else{logger[_0x3564('0x14')](_0x3564('0xd'),_0x38ef0a,_0x3564('0xe'));_0x346c49(_0x5bb9f5[_0x3564('0x15')][_0x3564('0x13')]);}})[_0x3564('0x16')](function(_0x565687){logger['error'](_0x3564('0xd'),_0x38ef0a,_0x565687);_0x49d3bb(_0x565687);});});}