Built motion from commit ffdca78c.|2.6.24
[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 _0xe360=['SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s','debug'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0xe360,0x1eb));var _0x0e36=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xe360[_0x2f1762];return _0x8ab21;};'use strict';var _=require('lodash');var util=require(_0x0e36('0x0'));var moment=require(_0x0e36('0x1'));var BPromise=require(_0x0e36('0x2'));var rs=require(_0x0e36('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0e36('0x4'));var logger=require(_0x0e36('0x5'))(_0x0e36('0x6'));var config=require(_0x0e36('0x7'));var jayson=require(_0x0e36('0x8'));var client=jayson[_0x0e36('0x9')][_0x0e36('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b38cc,_0x3678fa,_0x4bcb2d){return new BPromise(function(_0x54582d,_0x353190){return client[_0x0e36('0xb')](_0x3b38cc,_0x4bcb2d)[_0x0e36('0xc')](function(_0x311a2b){logger['info'](_0x0e36('0xd'),_0x3678fa,'request\x20sent');logger[_0x0e36('0xe')](_0x0e36('0xf'),_0x3678fa,_0x0e36('0x10'),JSON[_0x0e36('0x11')](_0x311a2b));if(_0x311a2b[_0x0e36('0x12')]){if(_0x311a2b[_0x0e36('0x12')]['code']===0x1f4){logger[_0x0e36('0x12')](_0x0e36('0xd'),_0x3678fa,_0x311a2b[_0x0e36('0x12')]['message']);return _0x353190(_0x311a2b[_0x0e36('0x12')][_0x0e36('0x13')]);}logger[_0x0e36('0x12')]('SalesforceField,\x20%s,\x20%s',_0x3678fa,_0x311a2b[_0x0e36('0x12')][_0x0e36('0x13')]);return _0x54582d(_0x311a2b[_0x0e36('0x12')][_0x0e36('0x13')]);}else{logger[_0x0e36('0x14')](_0x0e36('0xd'),_0x3678fa,_0x0e36('0x10'));_0x54582d(_0x311a2b['result'][_0x0e36('0x13')]);}})[_0x0e36('0x15')](function(_0x44eb75){logger['error'](_0x0e36('0xd'),_0x3678fa,_0x44eb75);_0x353190(_0x44eb75);});});}