Interface InvoiceUserApi

    • Method Detail

      • getInvoicesByAccount

        List<Invoice> getInvoicesByAccount​(UUID accountId,
                                           boolean includesMigrated,
                                           boolean includeVoidedInvoices,
                                           boolean includeInvoiceComponents,
                                           TenantContext context)
        Get all invoices for a given account.
        Parameters:
        accountId - account id
        includesMigrated - flag that indicates if migrated invoices should be returned
        includeVoidedInvoices - flag that indicates if voided invoices should be returned
        includeInvoiceComponents - flag that indicates if invoice components (items, payments, etc.) should be returned
        context - the tenant context
        Returns:
        all invoices
      • getInvoicesByAccount

        Pagination<Invoice> getInvoicesByAccount​(UUID accountId,
                                                 Long offset,
                                                 Long limit,
                                                 TenantContext context)
        Parameters:
        accountId - account id
        offset - the offset of the first result
        limit - the maximum number of results to retrieve
        context - the tenant context
        Returns:
        paginated invoices
      • getInvoicesByAccount

        List<Invoice> getInvoicesByAccount​(UUID accountId,
                                           org.joda.time.LocalDate fromDate,
                                           org.joda.time.LocalDate upToDate,
                                           boolean includeVoidedInvoices,
                                           boolean includeInvoiceComponents,
                                           TenantContext context)
        Find invoices from a given day, for a given account.
        Parameters:
        accountId - account id
        fromDate - the earliest included target day to consider, in the account timezone
        upToDate - the latest included target day to consider, in the account timezone
        includeInvoiceComponents - flag that indicates if invoice components (items, payments, etc.) should be returned
        context - the tenant context
        Returns:
        a list of invoices
      • getInvoicesByGroup

        List<Invoice> getInvoicesByGroup​(UUID accountId,
                                         UUID groupId,
                                         TenantContext context)
        Parameters:
        accountId - account id
        groupId - the group id
        context - the tenant context
        Returns:
      • getInvoices

        Pagination<Invoice> getInvoices​(Long offset,
                                        Long limit,
                                        TenantContext context)
        Parameters:
        context - the user context
        offset - the offset of the first result
        limit - the maximum number of results to retrieve
        Returns:
        the list of invoices for that tenant
      • searchInvoices

        Pagination<Invoice> searchInvoices​(String searchKey,
                                           Long offset,
                                           Long limit,
                                           TenantContext context)
        Find all invoices having their id, number, account id or currency matching the search key
        Parameters:
        searchKey - the search key
        offset - the offset of the first result
        limit - the maximum number of results to retrieve
        context - the user context
        Returns:
        the list of invoices matching this search key for that tenant
      • getAccountBalance

        BigDecimal getAccountBalance​(UUID accountId,
                                     TenantContext context)
        Retrieve the account balance.
        Parameters:
        accountId - account id
        context - the tenant context
        Returns:
        the account balance
      • getAccountCBA

        BigDecimal getAccountCBA​(UUID accountId,
                                 TenantContext context)
        Retrieve the account CBA.
        Parameters:
        accountId - account id
        context - the tenant context
        Returns:
        the account CBA
      • getUnpaidInvoicesByAccountId

        Collection<Invoice> getUnpaidInvoicesByAccountId​(UUID accountId,
                                                         org.joda.time.LocalDate fromDate,
                                                         org.joda.time.LocalDate upToDate,
                                                         TenantContext context)
        Find unpaid invoices for a given account, up to a given day.
        Parameters:
        accountId - account id
        fromDate - the earliest included target day to consider, in the account timezone
        upToDate - the latest included target day to consider, in the account timezone
        context - the tenant context
        Returns:
        a collection of invoices
      • triggerInvoiceGeneration

        Invoice triggerInvoiceGeneration​(UUID accountId,
                                         org.joda.time.LocalDate targetDate,
                                         Iterable<PluginProperty> properties,
                                         CallContext context)
                                  throws InvoiceApiException
        Trigger an invoice for a given account and a given day.
        Parameters:
        accountId - account id
        targetDate - the target day, in the account timezone
        properties - plugin specific properties
        context - the call context
        Returns:
        the invoice generated
        Throws:
        InvoiceApiException
      • triggerInvoiceGroupGeneration

        Iterable<Invoice> triggerInvoiceGroupGeneration​(UUID accountId,
                                                        org.joda.time.LocalDate targetDate,
                                                        Iterable<PluginProperty> properties,
                                                        CallContext context)
                                                 throws InvoiceApiException
        Trigger an invoice for a given account and a given day. If there is an active plugin implementing the InvoicePluginApi#getInvoiceGrouping it will be invoked, and as a result we may end up with N invoices.
        Parameters:
        accountId - account id
        targetDate - the target day, in the account timezone
        properties - plugin specific properties
        context - the call context
        Returns:
        the invoice generated
        Throws:
        InvoiceApiException
      • triggerDryRunInvoiceGeneration

        Invoice triggerDryRunInvoiceGeneration​(UUID accountId,
                                               org.joda.time.LocalDate targetDate,
                                               DryRunArguments dryRunArguments,
                                               Iterable<PluginProperty> properties,
                                               CallContext context)
                                        throws InvoiceApiException
        Trigger an invoice for a given account and a given day.
        Parameters:
        accountId - account id
        targetDate - the target day, in the account timezone
        dryRunArguments - dry run arguments
        properties - plugin specific properties
        context - the call context
        Returns:
        the invoice generated
        Throws:
        InvoiceApiException
      • insertExternalCharges

        List<InvoiceItem> insertExternalCharges​(UUID accountId,
                                                org.joda.time.LocalDate effectiveDate,
                                                Iterable<InvoiceItem> charges,
                                                boolean autoCommit,
                                                Iterable<PluginProperty> properties,
                                                CallContext context)
                                         throws InvoiceApiException
        Add one or multiple external charges to an account.
        Parameters:
        accountId - account id
        effectiveDate - the effective date for newly created invoices (in the account timezone)
        charges - the charges
        autoCommit - the flag to indicate if the invoice is set to COMMITTED or DRAFT and events are sent
        context - the call context
        Returns:
        the external charges invoice items
        Throws:
        InvoiceApiException
      • insertTaxItems

        List<InvoiceItem> insertTaxItems​(UUID accountId,
                                         org.joda.time.LocalDate effectiveDate,
                                         Iterable<InvoiceItem> taxes,
                                         boolean autoCommit,
                                         Iterable<PluginProperty> properties,
                                         CallContext context)
                                  throws InvoiceApiException
        Add one or multiple tax items to one invoice.
        Parameters:
        accountId - account id
        effectiveDate - the effective date for newly created invoice (in the account timezone)
        taxes - the tax items
        autoCommit - the flag to indicate if the invoice is set to COMMITTED or DRAFT and events are sent
        context - the call context
        Returns:
        the tax invoice items
        Throws:
        InvoiceApiException
      • insertCredits

        List<InvoiceItem> insertCredits​(UUID accountId,
                                        org.joda.time.LocalDate effectiveDate,
                                        Iterable<InvoiceItem> creditItems,
                                        boolean autoCommit,
                                        Iterable<PluginProperty> properties,
                                        CallContext context)
                                 throws InvoiceApiException
        Add a credit to an account.
        Parameters:
        accountId - account id
        effectiveDate - the day to grant the credit, in the account timezone
        creditItems - the list of credits to add
        autoCommit - the flag to indicate if the invoice is set to COMMITTED or DRAFT and events are sent
        context - the call context
        properties - the plugin specific properties
        Returns:
        the credit invoice items
        Throws:
        InvoiceApiException
      • insertInvoiceItemAdjustment

        InvoiceItem insertInvoiceItemAdjustment​(UUID accountId,
                                                UUID invoiceId,
                                                UUID invoiceItemId,
                                                org.joda.time.LocalDate effectiveDate,
                                                String description,
                                                String itemDetails,
                                                Iterable<PluginProperty> properties,
                                                CallContext context)
                                         throws InvoiceApiException
        Adjust fully a given invoice item.
        Parameters:
        accountId - account id
        invoiceId - invoice id
        invoiceItemId - invoice item id
        effectiveDate - the effective date for this adjustment invoice item (in the account timezone)
        description - the item description
        itemDetails - the item details
        properties - the plugin specific properties
        context - the call context
        Returns:
        the adjustment invoice item
        Throws:
        InvoiceApiException
      • insertInvoiceItemAdjustment

        InvoiceItem insertInvoiceItemAdjustment​(UUID accountId,
                                                UUID invoiceId,
                                                UUID invoiceItemId,
                                                org.joda.time.LocalDate effectiveDate,
                                                BigDecimal amount,
                                                Currency currency,
                                                String description,
                                                String itemDetails,
                                                Iterable<PluginProperty> properties,
                                                CallContext context)
                                         throws InvoiceApiException
        Adjust partially a given invoice item.
        Parameters:
        accountId - account id
        invoiceId - invoice id
        invoiceItemId - invoice item id
        effectiveDate - the effective date for this adjustment invoice item (in the account timezone)
        amount - the adjustment amount
        currency - adjustment currency
        description - the item description
        itemDetails - the item details
        properties - the plugin specific properties
        context - the call context
        Returns:
        the adjustment invoice item
        Throws:
        InvoiceApiException
      • deleteCBA

        void deleteCBA​(UUID accountId,
                       UUID invoiceId,
                       UUID invoiceItemId,
                       CallContext context)
                throws InvoiceApiException
        Delete a CBA item.
        Parameters:
        accountId - account id
        invoiceId - invoice id
        invoiceItemId - invoice item id (must be of type CBA_ADJ)
        context - the call context
        Throws:
        InvoiceApiException
      • consumeExistingCBAOnAccountWithUnpaidInvoices

        void consumeExistingCBAOnAccountWithUnpaidInvoices​(UUID accountId,
                                                           CallContext context)
        Rebalance CBA for account which have credit and unpaid invoices-- only needed if system is configured to not rebalance automatically.
        Parameters:
        accountId - account id
        context - the call context
      • createMigrationInvoice

        UUID createMigrationInvoice​(UUID accountId,
                                    org.joda.time.LocalDate invoiceDate,
                                    Iterable<InvoiceItem> items,
                                    CallContext context)
        Parameters:
        accountId - account id
        invoiceDate - maximum billing event day to consider (in the account timezone)
        items - items to be placed on the migration invoice
        context - call call context
        Returns:
        The UUID of the created invoice
      • transferChildCreditToParent

        void transferChildCreditToParent​(UUID childAccountId,
                                         CallContext context)
                                  throws InvoiceApiException
        Move a given child credit to the parent level
        Parameters:
        childAccountId - child account id
        context - the tenant context
        Throws:
        InvoiceApiException
      • getInvoiceItemsByParentInvoice

        List<InvoiceItem> getInvoiceItemsByParentInvoice​(UUID parentInvoiceId,
                                                         TenantContext context)
                                                  throws InvoiceApiException
        Retrieve invoice items details associated to Parent SUMMARY invoice item
        Parameters:
        parentInvoiceId - the parent invoice id
        context - the tenant context
        Returns:
        a list of invoice items associated with a parent invoice
        Throws:
        InvoiceApiException - if any unexpected error occurs
      • getInvoiceAuditLogsWithHistoryForId

        List<AuditLogWithHistory> getInvoiceAuditLogsWithHistoryForId​(UUID invoiceId,
                                                                      AuditLevel auditLevel,
                                                                      TenantContext context)
        Get all the audit entries with history for a given invoice.
        Parameters:
        invoiceId - the invoice id
        auditLevel - audit level (verbosity)
        context - the tenant context
        Returns:
        all audit entries with history for an invoice
      • getInvoiceItemAuditLogsWithHistoryForId

        List<AuditLogWithHistory> getInvoiceItemAuditLogsWithHistoryForId​(UUID invoiceItemId,
                                                                          AuditLevel auditLevel,
                                                                          TenantContext context)
        Get all the audit entries with history for a given invoice item.
        Parameters:
        invoiceItemId - the invoice item id
        auditLevel - audit level (verbosity)
        context - the tenant context
        Returns:
        all audit entries with history for an invoice item
      • getInvoicePaymentAuditLogsWithHistoryForId

        List<AuditLogWithHistory> getInvoicePaymentAuditLogsWithHistoryForId​(UUID invoicePaymentId,
                                                                             AuditLevel auditLevel,
                                                                             TenantContext context)
        Get all the audit entries with history for a given invoice payment.
        Parameters:
        invoicePaymentId - the invoice payment id
        auditLevel - audit level (verbosity)
        context - the tenant context
        Returns:
        all audit entries with history for an invoice payment