def catalogues(): try: logger = logging.getLogger('app') token = request.args.get('token') logger.debug(token) logger.debug('Executing ... ') catalogs_response = paybook.catalogues(token) logger.debug('Sending response ... ') catalogs_response = _Utilities.Success(catalogs_response).get_response() except _Paybook_Error as e: catalogs_response = e.get_response() except Exception as e: catalogs_response = _Utilities.internal_server_error(e) return catalogs_response
def sessions(): try: logger = logging.getLogger('app') logger.debug('\n/sessions') token = request.args.get('token') logger.debug(token) logger.debug('Executing ... ') session_response = paybook.validate_session(token) logger.debug('Sending response ... ') session_response = _Utilities.Success(session_response).get_response() except _Paybook_Error as e:# Just an example of how to catch a Paybook API error using SDK session_response = e.get_response() except Exception as e: session_response = _Utilities.internal_server_error(e) return session_response
def get_credentials(): try: logger = logging.getLogger('app') logger.debug('\n/credentials') token = request.args.get('token') logger.debug(token) logger.debug('Executing ... ') credentials_response = paybook.get_credentials(token) logger.debug('Sending response ... ') credentials_response = _Utilities.Success(credentials_response).get_response() except _Paybook_Error as e: credentials_response = e.get_response() except Exception as e: credentials_response = _Utilities.internal_server_error(e) return credentials_response
def login(): try: logger = logging.getLogger('app') logger.debug('\n/login') params = json.loads(request.data) logger.debug(params) username = params['username'] password = params['password'] logger.debug('Executing ... ') login_response = paybook.login(username,password) logger.debug('Sending response ... ') login_response = _Utilities.Success(login_response).get_response() except _Paybook_Error as e: login_response = e.get_response() except Exception as e: login_response = _Utilities.internal_server_error(e) return login_response
def signup(): try: logger = logging.getLogger('app') logger.debug('\n/signup') params = json.loads(request.data) logger.debug(params) username = params['username'] password = params['password'] logger.debug('Executing ... ') signup_response = paybook.signup(username,password) logger.debug('Sending response ... ') signup_response = _Utilities.Success(signup_response).get_response() except _Paybook_Error as e:# Just an example of how to catch a Paybook API error using SDK signup_response = e.get_response() except Exception as e: signup_response = _Utilities.internal_server_error(e) return signup_response
def status(): try: logger = logging.getLogger('app') logger.debug('\n/status') token = request.args.get('token') id_site = request.args.get('id_site') logger.debug(token) logger.debug(id_site) logger.debug('Executing ... ') status_response = paybook.status(token,id_site) logger.debug('Sending response ... ') status_response = _Utilities.Success(status_response).get_response() except _Paybook_Error as e: status_response = e.get_response() except Exception as e: status_response = _Utilities.internal_server_error(e) return status_response
def delete_credentials(): try: logger = logging.getLogger('app') logger.debug('\n/credentials') params = json.loads(request.data) logger.debug(params) token = params['token'] id_credential = params['id_credential'] logger.debug('Executing ... ') delete_response = paybook.delete_credentials(token,id_credential) logger.debug('Sending response ... ') delete_response = _Utilities.Success(delete_response).get_response() except _Paybook_Error as e: delete_response = e.get_response() except Exception as e: delete_response = _Utilities.internal_server_error(e) return delete_response
def transactions(): try: logger = logging.getLogger('app') logger.debug('\n/transactions') params = json.loads(request.data) logger.debug(params) token = params['token'] id_account = params['id_account'] logger.debug('Executing ... ') account_transactions = paybook.transactions(token,id_account) logger.debug('Sending response ... ') transactions_response = _Utilities.Success({'transactions':account_transactions}).get_response() except _Paybook_Error as e: transactions_response = e.get_response() except Exception as e: transactions_response = _Utilities.internal_server_error(e) return transactions_response
def accounts(): try: logger = logging.getLogger('app') logger.debug('\n/accounts') token = request.args.get('token') id_site = request.args.get('id_site') logger.debug(token) logger.debug(id_site) logger.debug('Executing ... ') site_accounts = paybook.accounts(token,id_site) logger.debug('Sending response ... ') accounts_response = _Utilities.Success({'accounts':site_accounts}).get_response() except _Paybook_Error as e: accounts_response = e.get_response() except Exception as e: accounts_response = _Utilities.internal_server_error(e) return accounts_response
def twofa(): try: logger = logging.getLogger('app') logger.debug('\n/twofa') params = json.loads(request.data) logger.debug(params) token = params['token'] id_site = params['id_site'] fatwo = params['twofa'] logger.debug('Executing ... ') twofa_response = paybook.twofa(token,id_site,fatwo) logger.debug('Sending response ... ') twofa_response = _Utilities.Success(twofa_response).get_response() except _Paybook_Error as e: twofa_response = e.get_response() except Exception as e: twofa_response = _Utilities.internal_server_error(e) return twofa_response
def accounts(): try: logger = logging.getLogger('app') logger.debug('\n/accounts') token = request.args.get('token') id_site = request.args.get('id_site') logger.debug(token) logger.debug(id_site) if id_site == 'null': id_site = None logger.debug('Executing ... ') site_accounts = paybook.accounts(token,id_site=id_site) logger.debug('Sending response ... ') accounts_response = _Utilities.Success(site_accounts).get_response() except _Paybook_Error as e: accounts_response = e.get_response() except Exception as e: accounts_response = _Utilities.internal_server_error(e) return accounts_response
def catalogues(): try: logger = logging.getLogger('app') token = request.args.get('token') is_true = request.args.get('is_true') logger.debug(token) logger.debug('Executing ... ') catalogs_response=None if is_true: catalogs_response = paybook.catalogues(token,is_true=True) else: catalogs_response = paybook.catalogues(token) logger.debug('Sending response ... ') catalogs_response = _Utilities.Success(catalogs_response).get_response() except _Paybook_Error as e: catalogs_response = e.get_response() except Exception as e: catalogs_response = _Utilities.internal_server_error(e) return catalogs_response
def transactions(): try: logger = logging.getLogger('app') logger.debug('\n/transactions') token = request.args.get('token') id_account = request.args.get('id_account') logger.debug(token) logger.debug(id_account) id_site = request.args.get('id_site') id_account = request.args.get('id_account') if id_site == 'null': id_site = None if id_account == 'null': id_account = None logger.debug('Executing ... ') account_transactions = paybook.transactions(token,id_account=id_account,id_site=id_site) logger.debug('Transactions: ' + str(len(account_transactions))) logger.debug('Sending response ... ') transactions_response = _Utilities.Success({'transactions':account_transactions}).get_response() except _Paybook_Error as e: transactions_response = e.get_response() except Exception as e: transactions_response = _Utilities.internal_server_error(e) return transactions_response