Create OCS Invoice

The Create OCS Invoice process in the OCS.io enables the generation and creation of invoices for customer accounts. This process involves gathering the relevant billing data, including products or services consumed, pricing information, and applicable taxes or discounts. The system applies the necessary calculations to generate a comprehensive and accurate invoice.

Pre-Conditions

  • Bill Cycle must be configured

  • Bill Cycle Run must be in proper state

  • Account

  • Account Bill Cycle Run

  • Document Type must be configured

  • Document Source must be configured

  • Document Preferences must be configured

  • Document Number Series must be configured

Calculate Invoice for Payment Responsible Account

Calculate Invoice for Payment Responsible Account Flow
Calculate Invoice for Payment Responsible Account
Step Actor Action Description

1.

Billing Server

Validate

Ensures the input data or conditions required for the process are valid.

2.

Billing Server

Set Defaults

Sets default values for the invoice creation process.

3.

Billing Server

Call Calculate Account

Calls the "Calculate Account" process for the payment responsible account.

4.

Billing Server

Call Calculate Account for Subordinate Accounts

Calls the "Calculate Account" process for each subordinate account associated with the payment responsible account.

5.

Billing Server

Apply Billing Discounts on Invoice

Applies applicable absolute or percentage discounts to the calculated charges on the invoice level if the account is the payment responsible.

6.

Billing Server

Apply Billing Fees on Invoice

Includes any additional charges or fees in the calculated charges on the invoice level if the account is the payment responsible.

7.

Billing Server

Calculate Totals

Calculates the total charges, discounts, fees, and taxes for the invoice.

8.

Billing Server

Calculate Rounding (Compensation)

Calculates any rounding adjustments or compensations for the invoice.

9.

Billing Server

Determine Tax Exemption

Determines if the invoice is eligible for tax exemption based on specific criteria.

10.

Billing Server

Calculate Tax Summary

Calculates the tax summary for the invoice, including tax amounts and rates.

11.

Billing Server

Check Negative Amount

Checks if the invoice has a negative amount and handles it appropriately.

12.

Billing Server

Store Invoice

Stores the invoice in the system.

13.

Billing Server

Store Tax Summary (InvoiceSummaryEvent)

Stores the tax summary information for the invoice.

14.

Billing Server

Store Aggregations on Subscriber, Account, Invoice level

Stores the aggregations of charges, discounts, fees, and taxes at the subscriber, account, and invoice levels.

15.

Billing Server

Store Rounding (Compensation)

Stores the rounding adjustments or compensations for the invoice.

16.

Billing Server

Store New/Updated Chargeable Events

Stores any new or updated chargeable events related to the invoice.

Validations

  1. accountSemaphore == WAITING

  2. paymentResponsible

  3. activation date (activationDate < bc.endDate)

  4. deactivation date (deactivationDate > bc.startDate)

tax exemption

  1. on account level

  2. on offer level ()

finish invoice

  1. check negative amount

  2. store invoice (Invoice)

  3. store tax summary (InvoiceSummaryEvent)

  4. store aggregated on Subscriber level (InvoiceSummaryEvent)

  5. store aggregated on Account level (InvoiceSummaryEvent)

  6. store aggregated on Invoice level (InvoiceSummaryEvent)

  7. store compensation (InvoiceSummaryEvent)

  8. store new/updated Chargeable Events (ChargeableEvent)

Calculate Account

Calculate Account Flow
Calculate Account
Step Actor Action Description

1.

Billing Server

Validate

Ensures the input data or conditions required for the process are valid.

2.

Billing Server

Call Calculate Subscriber

Calls the "Calculate Subscriber" process for each subscriber associated with the account.

3.

Billing Server

Apply Pro-Rate

Determines the duration of time for which the account is active and will be billed.

4.

Billing Server

Call Calculate Offer Subscription on Account

Calls the "Calculate Subscription" process for each offer subscription associated with the account.

5.

Billing Server

Process Events on Account

Includes the chargeable and aggregated events for one-time fees that are not associated with any subscription on the account.

6.

Billing Server

Summarize Account

Calculates the total charges for the account based on the calculated charges for account and for sub-ordinate subscribers and offer subscriptions.

7.

Billing Server

Apply Billing Discounts on Account

Applies applicable absolute or percentage discounts to the calculated charges on the account level.

8.

Billing Server

Apply Billing Fees on Account

Includes any additional charges or fees in the calculated charges on the account level.

Validate

  1. activation date (activationDate < bc.endDate)

  2. deactivation date (deactivationDate > bc.startDate)

Apply Pro-Rate

  1. Lifecycle Stage History: Retrieve the lifecycle stage history of the account.

  2. Chargeable Period Calculation: Compute the ratio between the duration of the chargeable period and the length of the billing cycle.

  3. State Eligibility: Determine state eligibility for charges based on the associated State Reason.

  4. Same-Day Changes: Account for changes occurring within the same day, excluding states like Suspension if the account is re-activated on the same day.

Process Events on Account

  1. Chargeable Events: Collect and process chargeable events, which include one-time fees and specific transactions at the account level.

  2. Aggregated Events: Collect and process aggregated events, providing a high-level overview of related activities.

Summarize Account

  1. Charge Aggregation: Summarize all charges at the account level based on Charging Class classification.

  2. Summary Utilization: Use these summaries as the foundation for applying fees or discounts in subsequent steps.

Apply Billing Discounts on Account

  1. Priority-Based Implementation: Apply discounts based on their designated priority level.

  2. Order of Application: Apply discounts in a hierarchical order if multiple discounts share the same priority.

  3. Pro-Rate Consideration: Incorporate pro-rate calculations for absolute billing discounts, applying a fraction of the discount based on the account’s chargeable duration.

Apply Billing Fees on Account

  1. Priority-Based Implementation: Apply fees based on their designated priority level.

  2. Order of Application: Apply fees in a hierarchical order if multiple fees share the same priority.

  3. Pro-Rate Consideration: Incorporate pro-rate calculations for fees like Minimal Commitment or Maximal Spent, applying a fraction of the fee based on the account’s chargeable duration.

Calculate Subscriber

Calculate Subscriber Flow
Calculate Subscriber
Step Actor Action Description

1.

Billing Server

Validate

Ensures the input data or conditions required for the process are valid.

2.

Billing Server

Apply Pro-Rate

Determines the duration of time for which the subscriber is active and will be billed.

3.

Billing Server

Call Calculate Offer Subscription on Subscriber

Calls the "Calculate Offer Subscription" process for each offer subscription associated with the subscriber.

4.

Billing Server

Process Events on Subscriber

Includes the chargeable and aggregated events for one-time fees that are not associated with any offer subscription on the subscriber.

5.

Billing Server

Summarize Subscriber

Calculates the total charges for the subscriber based on the calculated charges for the subscriber and for the offer subscriptions.

6.

Billing Server

Apply Billing Discounts on Subscriber

Applies applicable absolute or percentage discounts to the calculated charges on the subscriber level.

7.

Billing Server

Apply Billing Fees on Subscriber

Includes any additional charges or fees in the calculated charges on the subscriber level.

Validate

  1. activation date (activationDate < bc.endDate)

  2. deactivation date (deactivationDate > bc.startDate)

Apply Pro-Rate

  1. Lifecycle Stage History: Retrieve the lifecycle stage history of the subscriber.

  2. Chargeable Period Calculation: Compute the ratio between the duration of the chargeable period and the length of the billing cycle.

  3. State Eligibility: Determine state eligibility for charges based on the associated State Reason.

  4. Same-Day Changes: Account for changes occurring within the same day, excluding states like Suspension if the subscriber is re-activated on the same day.

Process Events on Subscriber

  1. Chargeable Events: Collect and process chargeable events, which include one-time fees and specific transactions at the subscriber level.

  2. Aggregated Events: Collect and process aggregated events, providing a high-level overview of related activities.

Summarize Subscriber

  1. Charge Aggregation: Summarize all charges at the subscriber level based on Charging Class classification.

  2. Summary Utilization: Use these summaries as the foundation for applying fees or discounts in subsequent steps.

Apply Billing Discounts on Subscriber

  1. Priority-Based Implementation: Apply discounts based on their designated priority level.

  2. Order of Application: Apply discounts in a hierarchical order if multiple discounts share the same priority.

  3. Pro-Rate Consideration: Incorporate pro-rate calculations for absolute billing discounts, applying a fraction of the discount based on the subscriber’s chargeable duration.

Apply Billing Fees on Subscriber

  1. Priority-Based Implementation: Apply fees based on their designated priority level.

  2. Order of Application: Apply fees in a hierarchical order if multiple fees share the same priority.

  3. Pro-Rate Consideration: Incorporate pro-rate calculations for fees like Minimal Commitment or Maximal Spent, applying a fraction of the fee based on the subscriber’s chargeable duration.

Calculate Offer Subscription

Calculate Offer Subscription Flow
Calculate Offer Subscription
Step Actor Action Description

1.

Billing Server

Validate

Ensures the input data or conditions required for the process are valid.

2.

Billing Server

Calculate Active Millis

Determines the duration of time for which the offer subscription is active and therefore will be billed.

3.

Billing Server

Include Chargeable Events on Offer Subscription

Includes the chargeable events registered on the offer subscription level. Pro-rate calculations may be performed in case the offer subscription changes its state during the period.

4.

Billing Server

Include Aggregated Events on Offer Subscription

Includes the aggregated events registered on the offer subscription level. No pro-rate calculations are performed.

5.

Billing Server

Summarize Offer Subscription

Calculates the total charges for the offer subscription based on the calculated charges, discounts, and fees.

6.

Billing Server

Calculate Billing Discounts on Offer Subscription

Applies applicable absolute or percentage discounts to the calculated charges on the offer subscription level.

7.

Billing Server

Calculate Billing Fees on Offer Subscription

Includes any additional charges or fees in the calculated charges on the offer subscription level.

8.

Billing Server

Aggregate on Offer Subscription Level

Aggregates the calculated charges, discounts, and fees to store the final billing information for the offer subscription.

Validate

  1. activation date (activationDate < bc.endDate)

  2. deactivation date (deactivationDate > bc.startDate)

Apply Pro-Rate

  1. Lifecycle Stage History: Retrieve the lifecycle stage history of the subscription.

  2. Chargeable Period Calculation: Compute the ratio between the duration of the chargeable period and the length of the billing cycle.

  3. State Eligibility: Determine state eligibility for charges based on the associated State Reason.

  4. Same-Day Changes: Account for changes occurring within the same day, excluding states like Suspension if the subscription is re-activated on the same day.

Process Events on Subscription

  1. Chargeable Events: Collect and process chargeable events, which include one-time fees and specific transactions at the subscription level.

  2. Aggregated Events: Collect and process aggregated events, providing a high-level overview of related activities.

Summarize Subscription

  1. Charge Aggregation: Summarize all charges at the subscription level based on Charging Class classification.

  2. Summary Utilization: Use these summaries as the foundation for applying fees or discounts in subsequent steps.

Apply Billing Discounts on Subscription

  1. Priority-Based Implementation: Apply discounts based on their designated priority level.

  2. Order of Application: Apply discounts in a hierarchical order if multiple discounts share the same priority.

  3. Pro-Rate Consideration: Incorporate pro-rate calculations for absolute billing discounts, applying a fraction of the discount based on the subscription’s chargeable duration.

Apply Billing Fees on Subscription

  1. Priority-Based Implementation: Apply fees based on their designated priority level.

  2. Order of Application: Apply fees in a hierarchical order if multiple fees share the same priority.

  3. Pro-Rate Consideration: Incorporate pro-rate calculations for fees like Minimal Commitment or Maximal Spent, applying a fraction of the fee based on the subscription’s chargeable duration.

Finalize Payment Responsible Account Invoice

  1. update AccountBillCycleRun (AccountSemaphore)

  2. send notifications