def get_transactions(self, access_token, from_date, to_date, source): """ Makes a payment on behalf of the customer to another UK bank account using the Faster Payments network :param access_token: the oauth bearer token :param from_date: filter transactions after this date. Format: YYYY-MM-DD :param to_date: filter transactions before this date. Format: YYYY-MM-DD :param source: the transaction type (e.g. faster payments, mastercard) if not specified, results are not filtered by source :return: the json response dict """ type_validation([access_token, from_date, to_date, source], get_transactions_parameter_definition) url = "{api_url}/api/v1/transactions{source}".format( api_url=self.options["api_url"], source=transaction_source(source)) logging.debug("GET {url}".format(url=url)) return request.get(url, headers=default_headers(access_token), params={ "from": from_date, "to": to_date })
def get_customer(self, access_token): """ Gets a customer's details :param access_token: the oauth bearer token :return: the json response dict """ type_validation([access_token], get_customer_parameter_definition) url = "{api_url}/api/v1/customers".format(api_url=self.options["api_url"]) logging.debug("GET {url}".format(url=url)) return request.get(url, headers=default_headers(access_token))
def get_me(self, access_token): """ Retrieves the customer UUID and permissions corresponding to the access token passed :param access_token: the oauth bearer token :return: the json response dict """ type_validation([access_token], get_me_parameter_definition) url = "{api_url}/api/v1/me".format(api_url=self.options["api_url"]) logging.debug("GET {url}".format(url=url)) return request.get(url, headers=default_headers(access_token))
def list_scheduled_payments(self, access_token): """ Lists the customer's scheduled payments :param access_token: the oauth bearer token :return: the json response dict """ type_validation([access_token], list_scheduled_payments_parameter_definition) url = "{api_url}/api/v1/payments/scheduled".format(api_url=self.options["api_url"]) logging.debug("GET {url}".format(url=url)) return request.get(url, headers=default_headers(access_token))
def get_balance(self, access_token): """ Retrieves the customer's balance :param access_token: the oauth bearer token :return: the json response dict """ type_validation([access_token], get_balance_parameter_definition) url = "{api_url}/api/v1/accounts/balance".format( api_url=self.options["api_url"]) logging.debug("GET {url}".format(url=url)) return request.get(url, headers=default_headers(access_token))
def list_mandates(self, access_token): """ Gets a list of the customer's current direct debit mandates :param access_token: the oauth bearer token :return: the json response dict """ type_validation([access_token], list_mandates_parameter_definition) url = "{api_url}/api/v1/direct-debit/mandates".format( api_url=self.options["api_url"]) logging.debug("GET {url}".format(url=url)) return request.get(url, headers=default_headers(access_token))
def list_savings_goals(self, access_token): """ Gets a lists of the customer's savings goals :param access_token: the oauth bearer token :return: the json response dict """ type_validation([access_token], list_savings_goals_parameter_definition) url = "{api_url}/api/v1/savings-goals".format( api_url=self.options["api_url"]) logging.debug("GET {url}".format(url=url)) return request.get(url, headers=default_headers(access_token))
def get_mandate(self, access_token, mandate_id): """ Gets a specific direct debit mandates :param access_token: the oauth bearer token :param mandate_id: the unique mandate ID :return: the json response dict """ type_validation([access_token], list_mandates_parameter_definition) url = "{api_url}/api/v1/direct-debit/mandates/{mandate_id}".format( api_url=self.options["api_url"], mandate_id=mandate_id) logging.debug("GET {url}".format(url=url)) return request.get(url, headers=default_headers(access_token))
def get_savings_goal(self, access_token, savings_goal_id): """ Gets a specific savings goal :param access_token: the oauth bearer token :param savings_goal_id: the savings goal's ID :return: the json response dict """ type_validation([access_token, savings_goal_id], get_savings_goals_parameter_definition) url = "{api_url}/api/v1/savings-goals/{goal_id}".format( api_url=self.options["api_url"], goal_id=savings_goal_id) logging.debug("GET {url}".format(url=url)) return request.get(url, headers=default_headers(access_token))
def get_transaction(self, access_token, transaction_id, source): """ Makes a payment on behalf of the customer to another UK bank account using the Faster Payments network :param access_token: the oauth bearer token :param transaction_id: the unique transaction ID :param source: the transaction type (e.g. faster payments, mastercard) if not specified, only generic transaction information is provided :return: the json response dict """ type_validation([access_token, transaction_id, source], get_transaction_parameter_definition) url = "{api_url}/api/v1/transactions{source}/{id}".format( api_url=self.options["api_url"], source=transaction_source(source), id=transaction_id) logging.debug("GET {url}".format(url=url)) return request.get(url, headers=default_headers(access_token))