Example #1
0
    def find_by_payment_identifier(identifier: int):
        """Find invoice by payment identifier."""
        invoice_dao = InvoiceModel.find_by_payment_id(identifier)

        invoice = Invoice()
        invoice._dao = invoice_dao  # pylint: disable=protected-access

        current_app.logger.debug('>find_by_id')
        return invoice
Example #2
0
    def find_by_payment_identifier(identifier: int, skip_auth_check: bool = False):
        """Find invoice by payment identifier."""
        invoice_dao = InvoiceModel.find_by_payment_id(identifier)

        if not skip_auth_check:
            Invoice._check_for_auth(invoice_dao)

        invoice = Invoice()
        invoice._dao = invoice_dao  # pylint: disable=protected-access

        current_app.logger.debug('>find_by_id')
        return invoice
Example #3
0
    def get_invoices(payment_identifier):
        """Find invoices."""
        current_app.logger.debug('<get_invoices')

        data = {'items': []}
        daos = [InvoiceModel.find_by_payment_id(payment_identifier)
                ]  # Treating as a set to avoid re-work in future
        for dao in daos:
            if dao:
                data['items'].append(Invoice.populate(dao).asdict())

        current_app.logger.debug('>get_invoices')
        return data
Example #4
0
    def get_invoices(payment_identifier: str, skip_auth_check: bool = False):
        """Find invoices."""
        current_app.logger.debug('<get_invoices')

        data = {'items': []}
        daos = [InvoiceModel.find_by_payment_id(payment_identifier)]  # Treating as a set to avoid re-work in future
        for dao in daos:
            if dao:
                if not skip_auth_check:
                    Invoice._check_for_auth(dao)
                data['items'].append(Invoice.populate(dao).asdict())

        current_app.logger.debug('>get_invoices')
        return data