def get_customers(self, accept, search=None, username=None, start=1, limit=25, mtype=None): """Does a GET request to /aggregation/v1/customers. Find all customers enrolled by the current partner, where the search text is found in the customer’s username or any combination of firstName and lastName fields. If no search text is provided, return all customers. Valid values for type are testing, active. If the value of moreAvailable in the response is true, you can retrieve the next page of results by increasing the value of the start parameter in your next request: …&start=6&limit=5 Args: accept (string): application/json, application/xml search (string, optional): The text you wish to match. Leave this empty if you wish to return all customers. Must be URL-encoded (see Handling Spaces in Queries) username (string, optional): Username for exact match. (Will return 0 or 1 records.) start (long|int, optional): Starting index for this page of results. The default value is 1. limit (long|int, optional): Maximum number of entries for this page of results. The default value is 25. mtype (string, optional): One of the values testing or active to return only customers of that type, or leave empty to return all customers. Returns: GetCustomersResponse: Response from the API. default response Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(accept=accept) # Prepare query URL _url_path = '/aggregation/v1/customers' _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_parameters = { 'search': search, 'username': username, 'start': start, 'limit': limit, 'type': mtype } _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, _query_parameters, Configuration.array_serialization) _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept } # Prepare and execute request _request = self.http_client.get(_query_url, headers=_headers) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize(_context.response.raw_body, GetCustomersResponse.from_dictionary)
def generate_voa_with_income_report(self, customer_id, accept, content_type, callback_url=None, from_date=None, body=None): """Does a POST request to /decisioning/v2/customers/{customerId}/voaHistory. Generate a Verification of Assets with GSE Income View (VOAHistory) report for all checking, savings, money market, and investment accounts for the given customer. This service retrieves up to 24 months of transaction history for each account and uses this information to generate the VOAHistory report. This is a premium service. The billing rate is the variable rate for Verification of Assets under the current subscription plan. The billable event is the successful generation of a VOAhistory report. A report consumer must be created for the given customer before calling Generate VOAHistory Report (see Report Consumers). After making this call, the client app may wait for a notification to be sent to the Report Listener Service, or it may enter a loop, which should wait 20 seconds and then call the service Get Report to see if the report is finished. While the report is being generated, Get Report will return a minimal report with status inProgress. The loop should repeat every 20 seconds until Get Report returns a different status. If using the listener service, the following format must be followed and the webhook must respond to the Finicity API with a 200 series code: https://api.finicity.com/decisioning/v2/customers/[customerId]/voaHisto ry?callbackUrl=[webhookUrl] HTTP status of 202 (Accepted) means the report is being generated. When the report is finished, a notification will be sent to the specified report callback URL, if specified. If no account of type of checking, savings, money market, or investment is found, the service will return HTTP 400 (Bad Request). Args: customer_id (long|int): Finicity Id of the customer accept (string): Replace 'json' with 'xml' if preferred content_type (string): Replace 'json' with 'xml' if preferred callback_url (string, optional): The Report Listener URL to receive notifications (optional, must be URL-encoded). from_date (long|int, optional): The fromDate parameter is an Epoch Timestamp (in seconds), such as ?1494449017?. Without this parameter, the report defaults to 61 days if available. This will limit the amount of credit and debit transactions included in the report up to the date specified, but will not limit the amount of income stream transactions. The income stream transactions are all included, up to 24 months, to help the lender and GSE's have the full history to validate income. Example: ?fromDate={fromDate}If included, the epoch timestamp should be 10 digits long and be within two years of the present day. Extending the epoch timestamp beyond 10 digits will default back to 2 years of data. This query is optional. body (RequestConstraints, optional): TODO: type description here. Example: Returns: GenerateVOAWithIncomeReportResponse: Response from the API. Accepted Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(customer_id=customer_id, accept=accept, content_type=content_type) # Prepare query URL _url_path = '/decisioning/v2/customers/{customerId}/voaHistory' _url_path = APIHelper.append_url_with_template_parameters( _url_path, {'customerId': customer_id}) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_parameters = { 'callbackUrl': callback_url, 'fromDate': from_date } _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, _query_parameters, Configuration.array_serialization) _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept, 'Content-Type': content_type } # Prepare and execute request _request = self.http_client.post( _query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) # Endpoint and global error handling using HTTP status codes. if _context.response.status_code == 400: raise Error1ErrorException('Bad Request', _context) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize( _context.response.raw_body, GenerateVOAWithIncomeReportResponse.from_dictionary)
def generate_asset_summary_report(self, customer_id, accept, content_type, callback_url=None, body=None): """Does a POST request to /decisioning/v2/customers/{customerId}/assetSummary. Generate Asset Summary report (assetSummary) for all checking, savings, money market, and investment accounts for the given customer. This service retrieves account and owner information as well as the number of NSFs for any account that is a checking account for the customer. This is a premium service. The billing rate is billed per report for the Asset Summary report. After making this call, the client app may wait for a notification to be sent to the Report Listener Service, or it may enter a loop, which should wait 20 seconds and then call the service Get Report to see if the report is finished. While the report is being generated, Get Report will return a minimal report with status inProgress. The loop should repeat every 20 seconds until Get Report returns a different status. If using the listener service, the following format must be followed and the webhook must respond to the Finicity API with a 200 series code: https://api.finicity.com/decisioning/v2/customers/[customerId]/assetSum mary?callbackUrl=[webhookUrl] HTTP status of 202 (Accepted) means the report is being generated. When the report is finished, a notification will be sent to the specified report callback URL, if specified. If no account type of checking, savings, money market, or investment is found, the service will return HTTP 400 (Bad Request). Args: customer_id (long|int): Finicity's ID of the customer accept (string): Replace 'json' with 'xml' if preferred content_type (string): Replace 'json' with 'xml' if preferred callback_url (string, optional): The Report Listener URL to receive notifications (optional, must be URL-encoded). body (RequestConstraints, optional): TODO: type description here. Example: Returns: GenerateAssetSummaryReportResponse: Response from the API. Accepted Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(customer_id=customer_id, accept=accept, content_type=content_type) # Prepare query URL _url_path = '/decisioning/v2/customers/{customerId}/assetSummary' _url_path = APIHelper.append_url_with_template_parameters( _url_path, {'customerId': customer_id}) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_parameters = {'callbackUrl': callback_url} _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, _query_parameters, Configuration.array_serialization) _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept, 'Content-Type': content_type } # Prepare and execute request _request = self.http_client.post( _query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) # Endpoint and global error handling using HTTP status codes. if _context.response.status_code == 400: raise Error1ErrorException('Bad Request', _context) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize( _context.response.raw_body, GenerateAssetSummaryReportResponse.from_dictionary)
def refresh_voie_payroll_report(self, customer_id, accept, content_type, body, callback_url=None): """Does a POST request to /decisioning/v2/customers/{customerId}/voiePayrollProvider. The VOIE – Payroll report generates when the customer completes Connect. Lenders, who commonly use this report for pre-close verification employment check, can refresh this report by passing the consumer’s SSN, DOB, and the `reportId` from the first VOIE – Payroll report they received. We’ll refresh this report and update any new pay histories since the first report generated, including borrower’s employment status as active or not. Note: Lenders can only refresh this report one time in a 60-day period starting from the date of the first report. Any further report refreshes will incur additional charges. The service immediately returns the status HTTP 202 (accepted). A notification gets sent to the report callback URL, if specified. After the call is made, the client’s application can wait for a notification sent by the Report Listener Service. Or it may enter a loop, which waits about 20 seconds and then calls the service, Get Report to check if the report is finished. While the report’s generating, Get Report returns a minimal report with a status of InProgress. The loop repeats every 20 seconds until Get Report returns a different status. Args: customer_id (long|int): Finicity ID for the customer accept (string): application/json content_type (string): application/json body (VOIEPayrollReportRefreshConstraints): TODO: type description here. Example: callback_url (string, optional): The Report Listener URL to receive notifications (optional, must be URL-encoded). Returns: RefreshVOIEPayrollReportResponse: Response from the API. Accepted Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(customer_id=customer_id, accept=accept, content_type=content_type, body=body) # Prepare query URL _url_path = '/decisioning/v2/customers/{customerId}/voiePayrollProvider' _url_path = APIHelper.append_url_with_template_parameters( _url_path, {'customerId': customer_id}) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_parameters = {'callbackUrl': callback_url} _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, _query_parameters, Configuration.array_serialization) _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept, 'Content-Type': content_type } # Prepare and execute request _request = self.http_client.post( _query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) # Endpoint and global error handling using HTTP status codes. if _context.response.status_code == 400: raise Error1ErrorException('Bad Request', _context) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize( _context.response.raw_body, RefreshVOIEPayrollReportResponse.from_dictionary)
def refresh_customer_accounts_by_institution_login(self, content_length, accept, customer_id, institution_login_id): """Does a POST request to /aggregation/v1/customers/{customerId}/institutionLogins/{institutionLoginId}/accounts. Refresh account and transaction data for all accounts associated with a given institutionLoginId with a connection to the institution. Client apps are not permitted to automate calls to the Refresh services. Active accounts are automatically refreshed by Finicity once per day. Because many financial institutions only post transactions once per day, calling Refresh repeatedly is usually a waste of resources and is not recommended. Apps may call Refresh services for a specific customer when there is a specific business case for the need of data that is up to date as of the moment. Please discuss with your account manager and systems engineer for further clarification. The recommended timeout setting for this request is 120 seconds in order to receive a response. However you can terminate the connection after making the call the operation will still complete. You will have to pull the account records to check for an updated aggregation attempt date to know when the refresh is complete. Args: content_length (int): Must be 0 (this request has no body) accept (string): application/json, application/xml customer_id (string): The ID of the customer who owns the accounts institution_login_id (string): The institution login ID from the account records Returns: CustomerAccounts: Response from the API. default response Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(content_length=content_length, accept=accept, customer_id=customer_id, institution_login_id=institution_login_id) # Prepare query URL _url_path = '/aggregation/v1/customers/{customerId}/institutionLogins/{institutionLoginId}/accounts' _url_path = APIHelper.append_url_with_template_parameters( _url_path, { 'customerId': customer_id, 'institutionLoginId': institution_login_id }) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Content-Length': content_length, 'Accept': accept, } # Prepare and execute request _request = self.http_client.post(_query_url, headers=_headers) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize(_context.response.raw_body, CustomerAccounts.from_dictionary)
def get_customer_transactions_all(self, accept, customer_id, from_date, to_date, start=1, limit=1000, sort='desc', include_pending=False): """Does a GET request to /aggregation/v3/customers/{customerId}/transactions. Get all transactions available for this customer within the given date range, across all accounts. This service supports paging and sorting by transactionDate (or postedDate if no transaction date is provided), with a maximum of 1000 transactions per request. Standard consumer aggregation provides up to 180 days of transactions prior to the date each account was added to the Finicity system. To access older transactions, you must first call the service Load Historic Transactions for Account. There is no limit for the size of the window between fromDate and toDate; however, the maximum number of transactions returned in one page is 1000. If the value of moreAvailable in the response is true, you can retrieve the next page of results by increasing the value of the start parameter in your next request: …&start=6&limit=5 Args: accept (string): application/json, application/xml customer_id (long|int): The ID of the customer whose transactions are to be retrieved from_date (long|int): Starting timestamp for the date range (required) (see Handling Dates and Times) to_date (long|int): Ending timestamp for the date range (required, must be greater than fromDate) (see Handling Dates and Times) start (long|int, optional): Starting index for this page of results limit (long|int, optional): Maximum number of entries for this page of results (max is 1000) sort (string, optional): Sort order: asc for ascending order (oldest transactions are on page 1), descfor descending order (newest transactions are on page 1). include_pending (bool, optional): true to include pending transactions if available. Returns: GetTransactionsResponse: Response from the API. default response Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(accept=accept, customer_id=customer_id, from_date=from_date, to_date=to_date) # Prepare query URL _url_path = '/aggregation/v3/customers/{customerId}/transactions' _url_path = APIHelper.append_url_with_template_parameters( _url_path, {'customerId': customer_id}) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_parameters = { 'fromDate': from_date, 'toDate': to_date, 'start': start, 'limit': limit, 'sort': sort, 'includePending': include_pending } _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, _query_parameters, Configuration.array_serialization) _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept } # Prepare and execute request _request = self.http_client.get(_query_url, headers=_headers) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize( _context.response.raw_body, GetTransactionsResponse.from_dictionary)
def generate_voi_report(self, customer_id, accept, content_type, callback_url=None, body=None): """Does a POST request to /decisioning/v2/customers/{customerId}/voi. Generate a Verification of Income (VOI) report for all checking, savings, and money market accounts for the given customer. This service retrieves up to two years of transaction history for each account and uses this information to generate the VOI report. This is a premium service. The billing rate is the variable rate for Verification of Income under the current subscription plan. The billable event is the successful generation of a VOI report. HTTP status of 202 (Accepted) means the report is being generated. When the report is finished, a notification will be sent to the specified report callback URL, if specified. If no account of type of checking, savings, or money market is found, the service will return HTTP 400 (Bad Request). Args: customer_id (long|int): Finicity ID for the customer accept (string): Replace 'json' with 'xml' if preferred content_type (string): Replace 'json' with 'xml' if preferred callback_url (string, optional): The Report Listener URL to receive notifications (optional, must be URL-encoded). body (RequestConstraints, optional): TODO: type description here. Example: Returns: GenerateVOIReportResponse: Response from the API. Accepted Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(customer_id=customer_id, accept=accept, content_type=content_type) # Prepare query URL _url_path = '/decisioning/v2/customers/{customerId}/voi' _url_path = APIHelper.append_url_with_template_parameters( _url_path, {'customerId': customer_id}) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_parameters = {'callbackUrl': callback_url} _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, _query_parameters, Configuration.array_serialization) _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept, 'Content-Type': content_type } # Prepare and execute request _request = self.http_client.post( _query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) # Endpoint and global error handling using HTTP status codes. if _context.response.status_code == 400: raise Error1ErrorException('Bad Request', _context) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize( _context.response.raw_body, GenerateVOIReportResponse.from_dictionary)
def get_customer_account_statement(self, accept, customer_id, account_id, index=1): """Does a GET request to /aggregation/v1/customers/{customerId}/accounts/{accountId}/statement. Connect to the account’s financial institution and download the most recent monthly statement for the account, in PDF format. This is an interactive refresh, so MFA challenges may be required. The index parameter allows an app to request statements earlier than the most recent one. The default is 1, meaning the most recent statement. Another value such as 3 would mean to count back and retrieve the third most recent statement. For example, if a request is made in July, the most recent statement (index 1) would probably be for June, and the third most recent statement (index 3) would be for April. This is a premium service. The billing rate is the variable rate for Account Ownership Verification under the current subscription plan. The billable event is a successful call to this service. HTTP status of 200 means the statement was retrieved successfully, and the body of the response contains the bytes of the PDF document. HTTP status of 203 means the response contains an MFA challenge in XML or JSON format. Contact your Account Manager or Systems Engineers to determine the best route to handle this HTTP status code. The recommended timeout setting for this request is 180 seconds in order to receive a response. Statements are only available for specific account types: checking, savings, money market, CDs, and investments. Statements are not available for the following account types: mortgage, credit card, line of credit, loan Args: accept (string): application/pdf, application/json (the document will be in PDF format, but errors will be JSON) customer_id (long|int): Finicity ‘s ID for the customer who owns the account account_id (long|int): Finicity’s ID of the account index (int, optional): Index of statement to retrieve (default is 1, maximum is 6) Returns: binary: Response from the API. default response Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(accept=accept, customer_id=customer_id, account_id=account_id) # Prepare query URL _url_path = '/aggregation/v1/customers/{customerId}/accounts/{accountId}/statement' _url_path = APIHelper.append_url_with_template_parameters( _url_path, { 'customerId': customer_id, 'accountId': account_id }) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_parameters = {'index': index} _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, _query_parameters, Configuration.array_serialization) _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept } # Prepare and execute request _request = self.http_client.get(_query_url, headers=_headers) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request, binary=True) self.validate_response(_context) # Return appropriate type return _context.response.raw_body
def generate_statement_report(self, accept, customer_id, body, callback_url=None): """Does a POST request to /decisioning/v2/customers/{customerId}/statement. Generate a Statement Report report for specified accounts under the given customer. This report requires a consumer. The service returns immediately with status HTTP 202 (Accepted). When finished, a notification will be sent to the specified report callback URL, if specified. This is a premium service. A billable event will be created upon the successful generation of the Statement Report. After making this call, the client app may wait for a notification to be sent to the Report Listener Service, or it may enter a loop, which should wait 20 seconds and then call the service Get Report to see if the report is finished. While the report is being generated, Get Report will return a minimal report including status inProgress. The loop should repeat every 20 seconds until Get Report returns a different status. A Report Consumer must be created for the given Customer (using Create Report Consumer) before calling this service. If no Report Consumer has been created, the service will return HTTP 400 (Bad Request). Args: accept (string): Replace 'json' with 'xml' if preferred customer_id (long|int): ID of the customer body (GenerateStatementReportConstraints): TODO: type description here. Example: callback_url (string, optional): The Report Listener URL to receive notifications (optional, must be URL-encoded) Returns: GenerateStatementReportResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(accept=accept, customer_id=customer_id, body=body) # Prepare query URL _url_path = '/decisioning/v2/customers/{customerId}/statement' _url_path = APIHelper.append_url_with_template_parameters( _url_path, {'customerId': customer_id}) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_parameters = {'callbackUrl': callback_url} _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, _query_parameters, Configuration.array_serialization) _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'content-type': 'application/json; charset=utf-8', 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept } # Prepare and execute request _request = self.http_client.post( _query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize( _context.response.raw_body, GenerateStatementReportResponse.from_dictionary)
def generate_v_2_connect_url(self, accept, body): """Does a POST request to /connect/v2/generate. No matter how you plan on implementing Finicity Connect, you’ll need to generate and retrieve a Finicity Connect Link. Connect provides you with a complete user experience, which requires minimal work in integration. Once you have generated the link it will only last until the authentication token under which it was generated expires. After that you will need to regenerate the Connect link under a new authentication token. We recommend generating a new authentication token when you generate a Connect link, to guarantee a full two hour life-span. Connect features: * Sign in, the user’s credentials and Multi-Factor Authentication (MFA) * Search for the user’s financial institutions * Manage the user’s accounts **MVS Developers** Use the `experience` parameter to call (per session) the Connect and the MVS application modules in the body of the request. You can prepopulate the consumer’s SSN (only the last 4 digits appear) and DOB to display on the Find employment records page at the beginning of the MVS payroll module. Pass the SSN and DOB values for the consumer in the body of the request call. Args: accept (string): application/json, application/xml body (GenerateV2ConnectURLRequest): Expected body to be sent with the request Returns: GenerateConnectURLResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(accept=accept, body=body) # Prepare query URL _url_path = '/connect/v2/generate' _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'content-type': 'application/json; charset=utf-8', 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept } # Prepare and execute request _request = self.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize(_context.response.raw_body, GenerateConnectURLResponse.from_dictionary)
def send_v_2_connect_email(self, accept, body): """Does a POST request to /connect/v2/send/email. Rather than adding a Connect URL link into your applications, this API allows you to send a Connect email to the consumer. The `experience` parameter refers to the type of connect experience (per session) you want for the customer such as, the brand color, logo, icon, and which credit decisioning report to generate when the Connect application completes. **Note**: Contact your Sales Account Team to set up the `experience` parameter. **MVS Developers**: Use the `experience` parameter to call (per session) the MVS application modules in the body of the request. When the consumer opens the email, they’ll click a button that opens the Connect application or the MVS application modules. You can prepopulate the consumer’s SSN (only the last 4 digits appear) and DOB to display on the Find employment records page at the beginning of the MVS payroll module. Pass the SSN and DOB values for the consumer in the body of the request call. Args: accept (string): application/json body (GenerateV2ConnectEmailRequest): Expected body to be sent with the request Returns: GenerateV2ConnectEmailResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(accept=accept, body=body) # Prepare query URL _url_path = '/connect/v2/send/email' _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'content-type': 'application/json; charset=utf-8', 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept } # Prepare and execute request _request = self.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize(_context.response.raw_body, GenerateV2ConnectEmailResponse.from_dictionary)
def get_account_owner(self, accept, customer_id, account_id): """Does a GET request to /aggregation/v1/customers/{customerId}/accounts/{accountId}/owner. Return the account owner’s name and address. This is a premium service. The billable event is a successful call to this service. HTTP status of 200 means the account owner’s name and address were retrieved successfully. HTTP status of 203 means the response contains an MFA challenge in XML or JSON format. Contact your Account Manager or Systems Engineers to determine the best route to handle this HTTP status code. This service retrieves account data from the institution. This usually returns quickly, but in some scenarios may take a few minutes to complete. In the event of a timeout condition, please retry the call. Args: accept (string): application/json, application/xml customer_id (long|int): Finicity’s ID for the customer account_id (long|int): Finicity’s ID of the account Returns: AccountOwnerV1: Response from the API. default response Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(accept=accept, customer_id=customer_id, account_id=account_id) # Prepare query URL _url_path = '/aggregation/v1/customers/{customerId}/accounts/{accountId}/owner' _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 'customerId': customer_id, 'accountId': account_id }) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept } # Prepare and execute request _request = self.http_client.get(_query_url, headers=_headers) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize(_context.response.raw_body, AccountOwnerV1.from_dictionary)
def create_consumer(self, customer_id, body, accept, content_type): """Does a POST request to /decisioning/v1/customers/{customerId}/consumer. Create a consumer record associated with the given customer. A consumer persists as the owner of any reports that are generated, even after the original customer is deleted from the system. A consumer must be created for the given customer before calling any of the Generate Report services. If a consumer already exists for this customer, this service will return HTTP 409 (Conflict). If the consumer is successfully created, the service will return HTTP 201 (Created). Args: customer_id (long|int): Finicity’s ID for the customer body (CreateConsumerRequest): TODO: type description here. Example: accept (string): Replace 'json' with 'xml' if preferred content_type (string): Replace 'json' with 'xml' if preferred Returns: CreateConsumerResponse: Response from the API. Created Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(customer_id=customer_id, body=body, accept=accept, content_type=content_type) # Prepare query URL _url_path = '/decisioning/v1/customers/{customerId}/consumer' _url_path = APIHelper.append_url_with_template_parameters( _url_path, {'customerId': customer_id}) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept, 'Content-Type': content_type } # Prepare and execute request _request = self.http_client.post( _query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) # Endpoint and global error handling using HTTP status codes. if _context.response.status_code == 404: raise Error1ErrorException('Bad Request', _context) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize( _context.response.raw_body, CreateConsumerResponse.from_dictionary)
def modify_consumer(self, consumer_id, body, accept, content_type): """Does a PUT request to /decisioning/v1/consumers/{consumerId}. Modify the details for an existing consumer. All fields are required for a consumer record, but individual fields for this call are optional because fields that are not specified will be left unchanged. If the service is successful, HTTP 204 (No Content) will be returned. If the consumer does not exist, the service will return HTTP 404. Args: consumer_id (string): Finicity ID of the consumer (UUID with max length 32 characters) body (ModifyConsumerRequest): Consumer details accept (string): Replace 'json' with 'xml' if preferred content_type (string): Replace 'json' with 'xml' if preferred Returns: void: Response from the API. No Content Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(consumer_id=consumer_id, body=body, accept=accept, content_type=content_type) # Prepare query URL _url_path = '/decisioning/v1/consumers/{consumerId}' _url_path = APIHelper.append_url_with_template_parameters( _url_path, {'consumerId': consumer_id}) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept, 'Content-Type': content_type } # Prepare and execute request _request = self.http_client.put( _query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) # Endpoint and global error handling using HTTP status codes. if _context.response.status_code == 404: raise Error1ErrorException('Bad Request', _context) self.validate_response(_context)
def add_testing_customer(self, accept, content_type, body): """Does a POST request to /aggregation/v2/customers/testing. This is a version 2 service that replaces version 1. The new version supports passing an applicationId for assigning applicationId's to customers if a partner has more than one registered app. Enroll a testing customer that is available for Test Drive accounts. For using testing customers when testing Finbank OAuth register a test application with your systems engineer or account manager. You would then use that testing applicationId for the creating of any testing customers. Testing customers can only be assigned to testing OAuth applications and Testing customers can only add accounts to Finbank OAuth for testing OAuth implementation as well as other Finbank testing institutions. Args: accept (string): application/json, application/xml content_type (string): application/json, application/xml body (AddCustomerRequest): The Fields For The New Customer Returns: AddCustomerResponse: Response from the API. default response Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(accept=accept, content_type=content_type, body=body) # Prepare query URL _url_path = '/aggregation/v2/customers/testing' _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept, 'Content-Type': content_type } # Prepare and execute request _request = self.http_client.post( _query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize(_context.response.raw_body, AddCustomerResponse.from_dictionary)
def get_portfolio_by_customer(self, customer_id, portfolio_id, accept, content_type): """Does a GET request to /decisioning/v1/customers/{customerId}/portfolios/{portfolioId}. Returns a portfolio of most recently generated report for each report type for a specified customer. If there are multiple reports that were generated for a report type (VOA, VOI, etc), only the most recently generated report for the type will be returned. HTTP 404 status means that there is no data for the customer or portfolio. HTTP 200 (OK) status means that the call was successful. Args: customer_id (long|int): Finicity ID of the customer portfolio_id (string): Finicity portfolio ID (Max 17 characters) with the portfolio version number. Using the portfolio number without a version number will return the most recently generated reports for the consumer. accept (string): Replace 'json' with 'xml' if preferred content_type (string): Replace 'json' with 'xml' if preferred Returns: PortfolioSummaryByCustomer: Response from the API. OK Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(customer_id=customer_id, portfolio_id=portfolio_id, accept=accept, content_type=content_type) # Prepare query URL _url_path = '/decisioning/v1/customers/{customerId}/portfolios/{portfolioId}' _url_path = APIHelper.append_url_with_template_parameters( _url_path, { 'customerId': customer_id, 'portfolioId': portfolio_id }) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept, 'Content-Type': content_type } # Prepare and execute request _request = self.http_client.get(_query_url, headers=_headers) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) # Endpoint and global error handling using HTTP status codes. if _context.response.status_code == 400: raise Error1ErrorException('Bad Request', _context) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize( _context.response.raw_body, PortfolioSummaryByCustomer.from_dictionary)
def generate_transactions_report(self, accept, callback_url, customer_id, body, from_date, to_date, include_pending): """Does a POST request to /decisioning/v2/customers/{customerId}/transactions. Generate a Transaction Report for specified accounts under the given customer. This service retrieves up to 24 months of transaction history for the given customer. It then uses this information to generate the Transaction Report. The service returns immediately with status HTTP 202 (Accepted). When finished, a notification will be sent to the specified report callback URL, if specified. This is a premium service. A billable event will be created upon the successful generation of the Transactions Report. After making this call, the client app may wait for a notification to be sent to the Report Listener Service, or it may enter a loop, which should wait 20 seconds and then call the service Get Report to see if the report is finished. While the report is being generated, Get Report will return a minimal report including status inProgress. The loop should repeat every 20 seconds until Get Report returns a different status. A Report Consumer must be created for the given Customer (using Create Report Consumer) before calling this service. If no Report Consumer has been created, the service will return HTTP 400 (Bad Request). There cannot be more than 24 months between fromDate and toDate. Args: accept (string): JSON or XML output. callback_url (string): The Report Listener URL to receive notifications (optional, must be URL-encoded) customer_id (long|int): ID of the customer body (GenerateTransactionsReportConstraints): TODO: type description here. Example: from_date (long|int): The `fromDate` param is an Epoch Timestamp (in seconds). It must be 10 digits long and within two years of the present day. Example: ?fromDate=1494449017. If fromDate is not used or it’s longer than 10 digits, the transaction report history defaults to 24 months of data. (Optional) to_date (long|int): The ending timestamp for the date range. The value must be greater than fromDate. See Handling Dates and Times. include_pending (bool): True: Include pending transactions in the report. False: Set by default. Returns: GenerateTransactionsReportResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(accept=accept, callback_url=callback_url, customer_id=customer_id, body=body, from_date=from_date, to_date=to_date, include_pending=include_pending) # Prepare query URL _url_path = '/decisioning/v2/customers/{customerId}/transactions' _url_path = APIHelper.append_url_with_template_parameters( _url_path, {'customerId': customer_id}) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_parameters = { 'callbackUrl': callback_url, 'fromDate': from_date, 'toDate': to_date, 'includePending': include_pending } _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, _query_parameters, Configuration.array_serialization) _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'content-type': 'application/json; charset=utf-8', 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept } # Prepare and execute request _request = self.http_client.post( _query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize( _context.response.raw_body, GenerateTransactionsReportResponse.from_dictionary)
def invoice_billing_endpoint(self, accept, partner_id, start_date, end_date, view_testing_reports, size=None, page=None): """Does a GET request to /decisioning/v1/partners/{partnerId}/billing/reseller. Partners would like the capability to see the reports generated for a specific date range as well as the custom fields associated with the report. This will allow partners to determine which branches have generated specific reports to better bill those branches Args: accept (string): Replace 'json' with 'xml' if preferred partner_id (string): Partner ID From Developer Portal start_date (string): The earliest date to be analyzed in this report. This is required. Note: The range between startDate and endDate must be 31 days or less. end_date (string): The latest date to be analyzed in this report. This is required. view_testing_reports (string): Designate as true to only display testing reports in the response. By default, this is false. size (string, optional): The size of the results returned per page. By default, this is 100 results per page and can be no more than 1000 results per page. This is optional. page (string, optional): The page to be viewed. Zero based index. This is optional. Default 0. Returns: InvoiceBillingResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(accept=accept, partner_id=partner_id, start_date=start_date, end_date=end_date, view_testing_reports=view_testing_reports) # Prepare query URL _url_path = '/decisioning/v1/partners/{partnerId}/billing/reseller' _url_path = APIHelper.append_url_with_template_parameters( _url_path, {'partnerId': partner_id}) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_parameters = { 'startDate': start_date, 'endDate': end_date, 'viewTestingReports': view_testing_reports, 'size': size, 'page': page } _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, _query_parameters, Configuration.array_serialization) _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept } # Prepare and execute request _request = self.http_client.get(_query_url, headers=_headers) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize( _context.response.raw_body, InvoiceBillingResponse.from_dictionary)
def get_app_registration_status_v_2(self, accept='application/json', pre_app_id=None, application_id=None, status=None, app_name=None, submitted_date=None, modified_date=None, page=1, page_size=1): """Does a GET request to /aggregation/v2/partners/applications. Get the status of your application registration to access financial institutions using OAuth connections. Args: accept (string, optional): application/json, application/xml pre_app_id (long|int, optional): Look up the status of an app by the preAppId application_id (string, optional): Look up the status of an app by the applicationId status (string, optional): Look up the status of app registration requests by the registration request status. Valid values P (For Pending), A (For Approved), R (For Rejected) app_name (string, optional): Look up app registration requests by the application name submitted_date (long|int, optional): Look up app registration requests by the date they were submitted in epoch format. modified_date (long|int, optional): Look up app registration requests by the date the request was updated. This could be used to determine when the app was updated to approved or rejected. page (long|int, optional): Select which page of results to return page_size (long|int, optional): Select how many results per page to return Returns: AppStatuses: Response from the API. Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Prepare query URL _url_path = '/aggregation/v2/partners/applications' _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_parameters = { 'preAppId': pre_app_id, 'applicationId': application_id, 'status': status, 'appName': app_name, 'submittedDate': submitted_date, 'modifiedDate': modified_date, 'page': page, 'pageSize': page_size } _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, _query_parameters, Configuration.array_serialization) _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept } # Prepare and execute request _request = self.http_client.get(_query_url, headers=_headers) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize(_context.response.raw_body, AppStatuses.from_dictionary)
def store_customer_pay_statement(self, finicity_app_key, finicity_app_token, customer_id, body): """Does a POST request to /aggregation/v1/customers/{customerId}/payStatements. Services to store a pay statement for a customer. Within the body of the request, the base 64 encoded value of the pay statement must be passed with a label. Args: finicity_app_key (string): Finicity-App-Key from Developer Portal finicity_app_token (string): Token returned from Partner Authentication customer_id (long|int): Finicity's ID of the customer body (StorePayStatementRequest): The label to be associated with the pay statement. These are recommended labels: - lastPayPeriod – The most recent (last) pay statement. This label will allow the paystub to go through primary data extraction. - lastPayPeriodMinusOne – The second most recent pay statement - lastPayPeriodMinusTwo – The third most recent pay statement - previousYearLastPayPeriod – Last pay statement of the previous calendar year - previousYear2LastPayPeriod – Last pay statement of the calendar year 2 years prior - earliestPayPeriod – The earliest pay statement statement - The base 64 encoded value for the pay statement. Returns: StorePayStatementResponse: Response from the API. default response Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(finicity_app_key=finicity_app_key, finicity_app_token=finicity_app_token, customer_id=customer_id, body=body) # Prepare query URL _url_path = '/aggregation/v1/customers/{customerId}/payStatements' _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 'customerId': customer_id }) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'accept': 'application/json', 'content-type': 'application/json; charset=utf-8', 'Finicity-App-Key': finicity_app_key, 'Finicity-App-Token': finicity_app_token } # Prepare and execute request _request = self.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize(_context.response.raw_body, StorePayStatementResponse.from_dictionary)
def generate_pay_statement_report(self, customer_id, accept, content_type, body, callback_url=None): """Does a POST request to /decisioning/v2/customers/{customerId}/payStatement. Generate Pay Statement Extraction Report for the given customer. This service accepts asset IDs of the stored pay statements to generate a Pay Statement Extraction Report. This is a premium service. The billing rate is the variable rate for Pay Statement Extraction Report under the current subscription plan. The billable event is the successful generation of a Pay Statement Extraction Report. The service returns immediately with status HTTP 202 (Accepted) if successful. When finished, a notification will be sent to the specified report callback URL, if specified. After making this call, the client app may wait for a notification to be sent to the Report Listener Service, or it may enter a loop, which should wait 20 seconds and then call the service Get Report to see if the report is finished. While the report is being generated, Get Report will return a minimal report including status inProgress. The loop should repeat every 20 seconds until Get Report returns a different status. The service will return HTTP 400 (Bad Request) if the asset ID does not exist within Finicity?s system. Args: customer_id (long|int): Finicity ID of the customer accept (string): Replace 'json' with 'xml' if preferred content_type (string): Replace 'json' with 'xml' if preferred body (PayStatementConstraints): TODO: type description here. Example: callback_url (string, optional): The Report Listener URL to receive notifications (optional, must be URL-encoded). Returns: GeneratePayStatementReportResponse: Response from the API. Accepted Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(customer_id=customer_id, accept=accept, content_type=content_type, body=body) # Prepare query URL _url_path = '/decisioning/v2/customers/{customerId}/payStatement' _url_path = APIHelper.append_url_with_template_parameters( _url_path, {'customerId': customer_id}) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_parameters = {'callbackUrl': callback_url} _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, _query_parameters, Configuration.array_serialization) _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept, 'Content-Type': content_type } # Prepare and execute request _request = self.http_client.post( _query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) # Endpoint and global error handling using HTTP status codes. if _context.response.status_code == 400: raise Error1ErrorException('Bad Request', _context) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize( _context.response.raw_body, GeneratePayStatementReportResponse.from_dictionary)
def get_voie_payroll_report_by_consumer(self, consumer_id, report_id, purpose, accept, content_type, on_behalf_of=None): """Does a GET request to /decisioning/v3/consumers/{consumerId}/reports/{reportId}. Get a report that has been generated by calling one of the Generate Report services. The report's status field will contain inProgress, failure, or success. If the status shows inProgress, the client app should wait 20 seconds and then call again to see if the report is finished. See Permissible Purpose Codes for a list of permissible purposes for retrieving a report. Args: consumer_id (string): Finicity’s ID of the consumer (UUID with max length 32 characters) report_id (string): Finicity’s ID of the report purpose (string): 2-digit code from Permissible Purpose Codes, specifying the reason for retrieving this report. accept (string): Replace 'json' with 'xml' if preferred content_type (string): Replace 'json' with 'xml' if preferred on_behalf_of (string, optional): The name of the entity you are retrieving the report on behalf of. Returns: VOIEPayrollReportRecord: Response from the API. OK Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(consumer_id=consumer_id, report_id=report_id, purpose=purpose, accept=accept, content_type=content_type) # Prepare query URL _url_path = '/decisioning/v3/consumers/{consumerId}/reports/{reportId}' _url_path = APIHelper.append_url_with_template_parameters( _url_path, { 'consumerId': consumer_id, 'reportId': report_id }) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_parameters = {'purpose': purpose, 'onBehalfOf': on_behalf_of} _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, _query_parameters, Configuration.array_serialization) _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept, 'Content-Type': content_type } # Prepare and execute request _request = self.http_client.get(_query_url, headers=_headers) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) # Endpoint and global error handling using HTTP status codes. if _context.response.status_code == 400: raise Error1ErrorException('Bad Request', _context) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize( _context.response.raw_body, VOIEPayrollReportRecord.from_dictionary)
def get_certified_institutions(self, accept, search, start=1, limit=25, mtype=None): """Does a GET request to /institution/v2/certifiedInstitutions. Search for institutions by certified product Args: accept (string): application/json, application/xml search (string): Text to match, or * to return all supported institutions. start (int, optional): Starting index for this page of results (ignored if returning all institutions). This will default to 1. limit (int, optional): Maximum number of entries for this page of results (ignored if returning all institutions). This will default to 25. Limits the number of results returned to 1000. mtype (string, optional): Allowed types: voa, voi, state_agg, ach, aha Returns: GetCertifiedInstitutionsResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(accept=accept, search=search) # Prepare query URL _url_path = '/institution/v2/certifiedInstitutions' _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_parameters = { 'search': search, 'start': start, 'limit': limit, 'type': mtype } _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, _query_parameters, Configuration.array_serialization) _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Accept': accept } # Prepare and execute request _request = self.http_client.get(_query_url, headers=_headers) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize( _context.response.raw_body, GetCertifiedInstitutionsResponse.from_dictionary)
def load_historic_transactions_for_customer_account( self, content_length, accept, customer_id, account_id): """Does a POST request to /aggregation/v1/customers/{customerId}/accounts/{accountId}/transactions/historic. Connect to the account’s financial institution and load up to 24 months of historic transactions for the account. Length of history varies by institution. This is a premium service. The billable event is a call to this service specifying a customerId that has not been seen before by this service. (If this service is called multiple times with the same customerId, to load transactions from multiple accounts, only one billable event has occurred.) HTTP status of 204 means historic transactions have been loaded successfully. The transactions are now available by calling Get Customer Account Transactions. HTTP status of 203 means the response contains an MFA challenge. Contact your Account Manager or Systems Engineers to determine the best route to handle this HTTP status code. The recommended timeout setting for this request is 180 seconds in order to receive a response. However you can terminate the connection after making the call the operation will still complete. You will have to pull the account records to check for an updated aggregation attempt date to know when the refresh is complete. This service usually requires the HTTP header Content-Length: 0 because it is a POST request with no request body. The date range sent to the institution is calculated from the account’s createdDate. This means that calling this service a second time for the same account normally will not add any new transactions for the account. For this reason, a second call to this service for a known accountId will usually return immediately with HTTP 204. In a few specific scenarios, it may be desirable to force a second connection to the institution for a known accountId. Some examples are: - The institution’s policy has changed, making more transactions available. - Finicity has now added a longer transaction history support for the institution. - The first call encountered an error, and the resulting Aggregation Ticket has now been fixed by the Finicity Support Team. In these cases, the POST request can contain the parameter force=true in the request body to force the second connection. Args: content_length (int): Must be 0 (this request has no body) accept (string): application/json, application/xml customer_id (long|int): The ID Of the customer who owns the account account_id (long|int): The Finicity ID of the account to pull transaction history for Returns: void: Response from the API. default response Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # Validate required parameters self.validate_parameters(content_length=content_length, accept=accept, customer_id=customer_id, account_id=account_id) # Prepare query URL _url_path = '/aggregation/v1/customers/{customerId}/accounts/{accountId}/transactions/historic' _url_path = APIHelper.append_url_with_template_parameters( _url_path, { 'customerId': customer_id, 'accountId': account_id }) _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'Finicity-App-Key': Configuration.finicity_app_key, 'Content-Length': content_length, 'Accept': accept } # Prepare and execute request _request = self.http_client.post(_query_url, headers=_headers) CustomHeaderAuth.apply(_request) _context = self.execute_request(_request) self.validate_response(_context)