f8766241ee78bc34dcabfc236d98e4e719c6981e
[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 _0x318a=['message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x318a,0x172));var _0xa318=function(_0x2e6c65,_0x503e58){_0x2e6c65=_0x2e6c65-0x0;var _0xb93089=_0x318a[_0x2e6c65];return _0xb93089;};'use strict';var _=require(_0xa318('0x0'));var util=require(_0xa318('0x1'));var moment=require(_0xa318('0x2'));var BPromise=require('bluebird');var rs=require(_0xa318('0x3'));var fs=require('fs');var Redis=require(_0xa318('0x4'));var db=require(_0xa318('0x5'))['db'];var utils=require(_0xa318('0x6'));var logger=require('../../config/logger')(_0xa318('0x7'));var config=require(_0xa318('0x8'));var jayson=require(_0xa318('0x9'));var client=jayson[_0xa318('0xa')][_0xa318('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8a22ea,_0x1964b1,_0x158705){return new BPromise(function(_0x26adf1,_0x51fb43){return client[_0xa318('0xc')](_0x8a22ea,_0x158705)[_0xa318('0xd')](function(_0x10db07){logger[_0xa318('0xe')](_0xa318('0xf'),_0x1964b1,_0xa318('0x10'));logger['debug'](_0xa318('0x11'),_0x1964b1,'request\x20sent',JSON[_0xa318('0x12')](_0x10db07));if(_0x10db07[_0xa318('0x13')]){if(_0x10db07['error'][_0xa318('0x14')]===0x1f4){logger[_0xa318('0x13')]('SalesforceField,\x20%s,\x20%s',_0x1964b1,_0x10db07['error']['message']);return _0x51fb43(_0x10db07[_0xa318('0x13')][_0xa318('0x15')]);}logger[_0xa318('0x13')]('SalesforceField,\x20%s,\x20%s',_0x1964b1,_0x10db07[_0xa318('0x13')]['message']);return _0x26adf1(_0x10db07[_0xa318('0x13')]['message']);}else{logger[_0xa318('0xe')](_0xa318('0xf'),_0x1964b1,_0xa318('0x10'));_0x26adf1(_0x10db07['result'][_0xa318('0x15')]);}})[_0xa318('0x16')](function(_0x13405c){logger[_0xa318('0x13')](_0xa318('0xf'),_0x1964b1,_0x13405c);_0x51fb43(_0x13405c);});});}