示例#1
0
 def __init__(self, bank_id, acc_id):
     self.bank_id = bank_id
     self.acc_id = acc_id
     self.request_url = ''
     self.data = None
     atbR = atbRequests()
     self.request_token = atbR.generate_login_token()
示例#2
0
 def get(self):
     atb_requests = atbRequests()
     response = atb_requests.atbGet(
         "https://api.leapos.ca/obp/v4.0.0/banks/3621ab3c23c3b1425fb18ee80a6a7ed/customers/OBC5252536580-71333"
     )
     return response
示例#3
0
 def get(self):
     atb_requests = atbRequests()
     response = atb_requests.atbGet(
         "https://api.leapos.ca/obp/v4.0.0/my/banks/3621ab3c23c3b1425fb18ee80a6a7ed/accounts/942525966868-10b8be5e-c3e/account"
     )
     return response
示例#4
0
 def get(self):
     atb_requests = atbRequests()
     response = atb_requests.atbGet(
         "https://api.leapos.ca/obp/v4.0.0/banks/3621ab3c23c3b1425fb18ee80a6a7ed/accounts"
     )
     return response
示例#5
0
 def get(self):
     atb_requests = atbRequests()
     response = atb_requests.atbGet(
         "/obp/v4.0.0/banks/3621ab3c23c3b1425fb18ee80a6a7ed/public/accounts/ACCOUNT_ID/owner/account"
     )
     return response
示例#6
0
from flask_restplus import Resource, Api, fields
from backend.utils.requestutil import atbRequests
from backend.utils.firebaseutil import FirebaseClient
from flask_restplus import reqparse
from backend.utils.transactionutil import TransactionRequest

parser = reqparse.RequestParser()
app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
api = Api(app,
          title='ATB Hackathon API',
          description='Web interface version of API')
app.run(ssl_context='adhoc')
fb_client = FirebaseClient()
atb_requests = atbRequests()


def get_donation_estimate(acc_id, bank_id):
    try:
        trans_req = TransactionRequest(bank_id, acc_id)
        trans_req.transaction_request()
        formatted_data = trans_req.format_data()
    except TypeError as e:
        return {"Error": "Invalid acc or bank id"}
    sum_transactions = 0
    balance_info = []
    curr_balance = float(formatted_data[0].get('balance'))
    for transaction in formatted_data:
        next_transaction = float(transaction.get('balance'))
        balance_info.append({