Built motion from commit e8d9bd62.|2.6.25
[motion2.git] / server / api / intSalesforceAccount / intSalesforceAccount.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 _0x5351=['raw','where','attributes','limit','map','include','model','stringify','ShowSalesforceAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x5351,0x1d1));var _0x1535=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5351[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x1535('0x0'));var moment=require(_0x1535('0x1'));var BPromise=require(_0x1535('0x2'));var rs=require(_0x1535('0x3'));var fs=require('fs');var Redis=require(_0x1535('0x4'));var db=require(_0x1535('0x5'))['db'];var utils=require(_0x1535('0x6'));var logger=require(_0x1535('0x7'))(_0x1535('0x8'));var config=require(_0x1535('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1535('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8b38f3,_0x27438f,_0x22c993){return new BPromise(function(_0x5aba20,_0x1ecabb){return client[_0x1535('0xb')](_0x8b38f3,_0x22c993)[_0x1535('0xc')](function(_0x4a134a){logger[_0x1535('0xd')](_0x1535('0xe'),_0x27438f,_0x1535('0xf'));logger[_0x1535('0x10')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x27438f,_0x1535('0xf'),JSON['stringify'](_0x4a134a));if(_0x4a134a[_0x1535('0x11')]){if(_0x4a134a[_0x1535('0x11')]['code']===0x1f4){logger['error'](_0x1535('0xe'),_0x27438f,_0x4a134a[_0x1535('0x11')]['message']);return _0x1ecabb(_0x4a134a[_0x1535('0x11')]['message']);}logger[_0x1535('0x11')](_0x1535('0xe'),_0x27438f,_0x4a134a['error']['message']);return _0x5aba20(_0x4a134a['error'][_0x1535('0x12')]);}else{logger[_0x1535('0xd')](_0x1535('0xe'),_0x27438f,'request\x20sent');_0x5aba20(_0x4a134a[_0x1535('0x13')][_0x1535('0x12')]);}})[_0x1535('0x14')](function(_0xd2dde5){logger[_0x1535('0x11')](_0x1535('0xe'),_0x27438f,_0xd2dde5);_0x1ecabb(_0xd2dde5);});});}exports[_0x1535('0x15')]=function(_0x1fabcd){var _0x35a24d=this;return new Promise(function(_0xafefb6,_0x1d0668){return db[_0x1535('0x16')][_0x1535('0x17')]({'raw':_0x1fabcd[_0x1535('0x18')]?_0x1fabcd[_0x1535('0x18')][_0x1535('0x19')]===undefined?!![]:![]:!![],'where':_0x1fabcd[_0x1535('0x18')]?_0x1fabcd[_0x1535('0x18')][_0x1535('0x1a')]||null:null,'attributes':_0x1fabcd[_0x1535('0x18')]?_0x1fabcd[_0x1535('0x18')][_0x1535('0x1b')]||null:null,'limit':_0x1fabcd[_0x1535('0x18')]?_0x1fabcd[_0x1535('0x18')][_0x1535('0x1c')]||null:null,'include':_0x1fabcd[_0x1535('0x18')]?_0x1fabcd[_0x1535('0x18')]['include']?_[_0x1535('0x1d')](_0x1fabcd[_0x1535('0x18')][_0x1535('0x1e')],function(_0x54273c){return{'model':db[_0x54273c['model']],'as':_0x54273c['as'],'attributes':_0x54273c[_0x1535('0x1b')],'include':_0x54273c[_0x1535('0x1e')]?_['map'](_0x54273c[_0x1535('0x1e')],function(_0x1a68cf){return{'model':db[_0x1a68cf[_0x1535('0x1f')]],'as':_0x1a68cf['as'],'attributes':_0x1a68cf[_0x1535('0x1b')],'include':_0x1a68cf['include']?_[_0x1535('0x1d')](_0x1a68cf[_0x1535('0x1e')],function(_0x11c040){return{'model':db[_0x11c040[_0x1535('0x1f')]],'as':_0x11c040['as'],'attributes':_0x11c040[_0x1535('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1535('0xc')](function(_0xe22048){logger[_0x1535('0xd')](_0x1535('0x15'),_0x1fabcd);logger[_0x1535('0x10')](_0x1535('0x15'),_0x1fabcd,JSON[_0x1535('0x20')](_0xe22048));_0xafefb6(_0xe22048);})[_0x1535('0x14')](function(_0x3b376e){logger[_0x1535('0x11')](_0x1535('0x15'),_0x3b376e[_0x1535('0x12')],_0x1fabcd);_0x1d0668(_0x35a24d[_0x1535('0x11')](0x1f4,_0x3b376e[_0x1535('0x12')]));});});};exports[_0x1535('0x21')]=function(_0x15b088){var _0x3f4953=this;return new Promise(function(_0x31a335,_0x2238f1){return db[_0x1535('0x16')][_0x1535('0x22')]({'raw':_0x15b088['options']?_0x15b088[_0x1535('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x15b088[_0x1535('0x18')]?_0x15b088[_0x1535('0x18')]['where']||null:null,'attributes':_0x15b088[_0x1535('0x18')]?_0x15b088[_0x1535('0x18')][_0x1535('0x1b')]||null:null,'include':_0x15b088[_0x1535('0x18')]?_0x15b088[_0x1535('0x18')][_0x1535('0x1e')]?_[_0x1535('0x1d')](_0x15b088[_0x1535('0x18')][_0x1535('0x1e')],function(_0x3e9a14){return{'model':db[_0x3e9a14[_0x1535('0x1f')]],'as':_0x3e9a14['as'],'attributes':_0x3e9a14['attributes'],'include':_0x3e9a14['include']?_[_0x1535('0x1d')](_0x3e9a14['include'],function(_0x2ebeec){return{'model':db[_0x2ebeec[_0x1535('0x1f')]],'as':_0x2ebeec['as'],'attributes':_0x2ebeec[_0x1535('0x1b')],'include':_0x2ebeec[_0x1535('0x1e')]?_[_0x1535('0x1d')](_0x2ebeec[_0x1535('0x1e')],function(_0x49ab9c){return{'model':db[_0x49ab9c[_0x1535('0x1f')]],'as':_0x49ab9c['as'],'attributes':_0x49ab9c[_0x1535('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1535('0xc')](function(_0x37109b){logger[_0x1535('0xd')]('ShowSalesforceAccount',_0x15b088);logger['debug']('ShowSalesforceAccount',_0x15b088,JSON[_0x1535('0x20')](_0x37109b));_0x31a335(_0x37109b);})[_0x1535('0x14')](function(_0x33d9ca){logger[_0x1535('0x11')](_0x1535('0x21'),_0x33d9ca['message'],_0x15b088);_0x2238f1(_0x3f4953[_0x1535('0x11')](0x1f4,_0x33d9ca['message']));});});};