def get_customer_accounts(self, accept, customer_id, status=None):
        """Does a GET request to /aggregation/v1/customers/{customerId}/accounts.

        Get details for all accounts owned by the specified customer.

        Args:
            accept (string): application/json, application/xml
            customer_id (long|int): The ID of the customer whose accounts are
                to be retrieved
            status (string, optional): append, ?status=pending, to return
                accounts in active and pending status. Pending accounts were
                discovered but not activated and will not have transactions or
                have balance updates

        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(accept=accept, customer_id=customer_id)

        # Prepare query URL
        _url_path = '/aggregation/v1/customers/{customerId}/accounts'
        _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 = {'status': status}
        _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,
                                          CustomerAccounts.from_dictionary)
Example #2
0
    def add_query_parameter(self, name, value):
        """ Add a query parameter to the HttpRequest.

        Args:
	        name (string): The name of the query parameter.
            value (string): The value of the query parameter.

        """
        self.query_url = APIHelper.append_url_with_query_parameters(
            self.query_url, {name: value})
        self.query_url = APIHelper.clean_url(self.query_url)
    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)
Example #4
0
    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)
Example #5
0
    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 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_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)
Example #8
0
    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_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 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_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 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 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 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)
Example #15
0
    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 get_certified_institutions_with_rssd(self, accept, search, start,
                                             limit, mtype):
        """Does a GET request to /institution/v2/certifiedInstitutions/rssd.

        Get Certified Institution List w/RSSD

        Args:
            accept (string): application/json, application/xml
            search (string): Search term, * returns all institutions
            start (int): Page (Default: 1)
            limit (int): Limits the number of results returned (max: 1000)
            mtype (string): product types trans_agg, 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,
                                 start=start,
                                 limit=limit,
                                 mtype=mtype)

        # Prepare query URL
        _url_path = '/institution/v2/certifiedInstitutions/rssd'
        _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 get_institutions(self, accept, search=None, start=1, limit=25):
        """Does a GET request to /institution/v2/institutions.

        Use this call to search all Financial Institutions (FI) the Finicity
        has connections with and supports.
        Return all financial institutions that contain the search text in the
        institution’s name, urlHomeApp, or urlLogonApp fields.
        To get a list of all FI’s, leave the search parameter out of the call.
        If the search query is left blank, the API will return an error.
        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:
        1st Request
        …….start=1&limit=25 (First 25 from list 1-25)
        2nd Request
        …….start=2&limit=25 (Next 25 from list 26-50)

        Args:
            accept (string): application/json, application/xml
            search (string, optional): Text to match, or omit the search
                parameter.  Must be URL-encoded (see Handling Spaces in
                Queries)
            start (int, optional): Starting index for this page of results.
                This defaults to 1.
            limit (int, optional): Maximum number of entries for this page of
                results. This defaults to 25. Limits the number of results
                returned to 1000.

        Returns:
            GetInstitutionsResponse: 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)

        # Prepare query URL
        _url_path = '/institution/v2/institutions'
        _query_builder = Configuration.get_base_uri()
        _query_builder += _url_path
        _query_parameters = {'search': search, 'start': start, 'limit': limit}
        _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,
            GetInstitutionsResponse.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)