-
Notifications
You must be signed in to change notification settings - Fork 0
/
TransactionApp.py
executable file
·52 lines (41 loc) · 1.93 KB
/
TransactionApp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#Copyright (c) 2015 Yodlee, Inc. All Rights Reserved.
# This software is the confidential and proprietary information of Yodlee, Inc.
# Use is subject to license terms.
import loginapp #importing loginapp, to get a coBrand and User Session response and used
import http1 #importing http1, its the key for all the apps, and to post and get the json response
import json #library package for the json response access
import yaml #converts unicode to byte code
import requests #requests, for requesting the response from json
#<summary>
#The TransactionApp class provides Transaction details.
#Steps to Use this App:
#i) doCoBrandLogin(coBrandUserName, coBrandPassword)
#ii) doMemberLogin(userName, userPassword)
#Browse all Accounts for member profile:
#getTransactions()
class TransactionApp:
fqcn = "TransactionApp"
global userSession
global cobSession
@staticmethod
def getTransactions():
global userSession
global cobSession
uSession = loginapp.userSession
cSession = loginapp.cobSession
hdr = {'Authorization':'{userSession='+uSession+',cobSession='+cSession+'}'}
mn = "getTransactions()"
print(TransactionApp.fqcn + " :: " + mn)
transactionsURL = loginapp.LoginApp.localURLVer1 + "v1/transactions/"
jsonResponse = http1.HTTP.doGet(transactionsURL, hdr)
parsed_json = json.loads(jsonResponse)
node = parsed_json.get("transaction",{})
print '--------------------------------------------------'
print "Container - Amount - BaseType"
print '--------------------------------------------------'
for i in node:
if('amount' in i):
print i['CONTAINER']," - ",i['amount']['amount']," - ",i['baseType']
elif(not('amount' in i)):
print i['CONTAINER']," - ",'0'," - ",i['baseType']
print '--------------------------------------------------'