def get_voie_payroll_report_by_customer(self, customer_id, report_id, purpose, accept, content_type, on_behalf_of=None): """Does a GET request to /decisioning/v3/customers/{customerId}/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: customer_id (long|int): Finicity’s ID of the customer 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(customer_id=customer_id, report_id=report_id, purpose=purpose, accept=accept, content_type=content_type) # Prepare query URL _url_path = '/decisioning/v3/customers/{customerId}/reports/{reportId}' _url_path = APIHelper.append_url_with_template_parameters( _url_path, { 'customerId': customer_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 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 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)