Skip to main content

Operation Group

Overview

Users can perform multiple operations within a single context by using an Operation Group (learn more). This ensures that all operations are executed within a single transaction. If any operation fails, all other operations in the group will be rolled back.

This approach is particularly useful when you need to link two or more operations. For example, if a user wants to make a payment using their loyalty points, there isn't a single operation to handle this. However, you can create an Operation Group and add a LoyaltyDeposit operation and a Payment operation to it.

If the payment fails for any reason, the entire Operation Group will be rolled back, including the LoyaltyDeposit. This guarantees data consistency across all operations in the group.

At the moment, only the following operations can be added in a Operation Group:

  • RemainderDeposit
  • CashDeposit
  • LoyaltyDeposit
  • Payment
  • CashWithdrawal

Like all other transactions, Operation Group is composed by two steps: Initialization and Confirmation/Cancellation. Once the Group is initialized an asynchronous OperationGroupInitialized event is raised, after that, you can use the OperationGroupId parameter to link other operations to the group.

Once you have added all the operations to the group, the User can choose whether to confirm or cancel the OperationGroup; if the OperationGroup is cancelled, the User's pending transactions linked to the group are also removed and an asynchronous OperationGroupCancelled event is generated. Otherwise, if the OperationGroup is confirmed, all the transactions linked to the group will be executed, the User's wallet balance will be updated and an asynchronous OperationGroupConfirmed event is generated.

Sequence Diagram

The sequence diagram below illustrates how to use an operation group.