1var boss_account_module = angular.module('bossApp'); 2boss_account_module.factory('AccountSummaryService', function($http,$q,CacheFactory,$rootScope) { 3 var _user = angular.copy($rootScope.currentUser); 4 if (!CacheFactory.get('accountSummaryCache')) { 5 CacheFactory.createCache('accountSummaryCache'); 6 } 7 var accountSummaryCache = CacheFactory.get('accountSummaryCache'); 8 return { 9 bankAccount_list: function(accountIds, getInActiveAccounts) { 10 var deferred = $q.defer(); 11 req = { 12 method: 'GET', 13 async: true, 14 url: $rootScope.api_Path+'bankAccount/get_allowed_bank_accounts', 15 params: {entityId: _user.entityId,accountIds:accountIds, getInActiveAccounts:getInActiveAccounts } 16 } 17 $http(req).then(function(response) { 18 deferred.resolve(response.data); 19 }); 20 21 return deferred.promise; 22 }, 23 getAllAccounts: function() { 24 var deferred = $q.defer(); 25 req = { 26 method: 'GET', 27 async: true, 28 url: $rootScope.api_Path+'bankAccount/get_all_account_list', 29 params: {entityId: _user.entityId } 30 } 31 $http(req).then(function(response) { 32 deferred.resolve(response.data); 33 }); 34 35 return deferred.promise; 36 }, 37 getMCABankAccountList: function() { 38 var deferred = $q.defer(); 39 if (accountSummaryCache.get("get_mca_bank_account_list")) { 40 deferred.resolve(accountSummaryCache.get("get_mca_bank_account_list")); 41 } else { 42 req = { 43 method: 'GET', 44 async: true, 45 url: $rootScope.api_Path+'bankAccount/get_mca_bank_account_list', 46 params: {entityId: _user.entityId } 47 } 48 $http(req,{ 49 cache: accountSummaryCache 50 }).then(function(response) { 51 accountSummaryCache.put("get_mca_bank_account_list", response.data); 52 deferred.resolve(response.data); 53 }); 54 } 55 return deferred.promise; 56 }, 57 getAccountBalance: function( _account_id ){ 58 req = { 59 method: 'POST', 60 async: true, 61 url: $rootScope.api_Path+'bankAccount/get_account_current_bal', 62 params: { bankAccountId: _account_id, userId:_user.userId} 63 } 64 return $http(req).then(function (response){ 65 return response.data; 66 }); 67 }, 68 getLedgerBalance: function( _accountNumber ){ 69 req = { 70 method: 'POST', 71 async: true, 72 url: $rootScope.api_Path+'bankAccount/getLedgerBalance', 73 params: { accountNumber: _accountNumber,entityId: _user.entityId} 74 } 75 return $http(req).then(function (response){ 76 return response.data; 77 }); 78 }, 79 plaidGetAccountBalance: function( accountId ){ 80 req = { 81 method: 'GET', 82 url: $rootScope.api_Path+'utility/plaidGetAccountBalance', 83 params: { accessToken : "123", 84 leId:sessionStorage.leId, 85 userId:sessionStorage.userId, 86 accountId:accountId} 87 } 88 return $http(req).then(function (response){ 89 return response.data; 90 }); 91 }, 92 saveOrUpdateAccount:function(account){ 93 account.accountSettings.legalEntityId=_user.entityId; 94 req = { 95 method: 'POST', 96 async: true, 97 url: $rootScope.api_Path+'bankAccount/saveOrUpdateAccount', 98 params: { 99 leId:_user.entityId, 100 userId:sessionStorage.userId 101 }, 102 data:account 103 } 104 return $http(req).then(function (response){ 105 return response.data; 106 }); 107 }, 108 getAccountSettings: function( accountId ){ 109 req = { 110 method: 'GET', 111 url: $rootScope.api_Path+'bankAccount/getAccountSettings', 112 params: {entityId:_user.entityId, 113 accountId:accountId} 114 } 115 return $http(req).then(function (response){ 116 return response.data; 117 }); 118 } 119 120 }; 121}); 122boss_account_module.factory('TransactionService', ['$http','CacheFactory','$rootScope','$q', function($http,CacheFactory,$rootScope,$q) { 123 if (!CacheFactory.get('transactionService')) { 124 CacheFactory.createCache('transactionService'); 125 } 126 var transactionService = CacheFactory.get('transactionService'); 127 128 return { 129 getTransactionList: function(_account_id){ 130 req = { 131 method: 'POST', 132 url: $rootScope.api_Path+'bankAccount/get_account_activity', 133 params: {accountId: _account_id } 134 } 135 return $http(req).then(function(response) { 136 return response.data; 137 }); 138 139 }, 140 get_CR_TransactionList: function(_accountId){ 141 req = { 142 method: 'POST', 143 url: $rootScope.api_Path+'bankAccount/getCRActivities', 144 params: {accountId: _accountId } 145 } 146 return $http(req).then(function(response) { 147 return response.data; 148 }); 149 150 },
151 getStaticInformation: function() { 152 var deferred = $q.defer(); 153 if (transactionService.get("getStaticInformation")) { 154 deferred.resolve(transactionService.get("getStaticInformation")); 155 } else { 156 req = { 157 method: 'GET', 158 url: $rootScope.api_Path+'bankAccount/getStaticInformation', 159 } 160 $http(req,{ 161 cache: transactionService 162 }).then(function(response) { 163 transactionService.put("getStaticInformation", response.data); 164 deferred.resolve(response.data); 165 }); 166 } 167 return deferred.promise; 168 }, 169 }; 170}]); 171 172 173boss_account_module.factory('AccountService', ['$http', function($http) { 174 var _list = []; 175 176 return { 177 getList: function() { 178 return _list; 179 }, 180 181 add: function(item) { 182 _list.push(item); 183 return item + ' is added'; 184 }, 185 186 remove: function(index) { 187 var item = _list.splice(index, 1)[0]; 188 return item + ' has been deleted'; 189 }, 190 191 emptyList: function() { 192 _list = []; 193 return 'list is empty'; 194 } 195 }; 196}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.