Broadleaf Microservices
  • v1.0.0-latest-prod

Voucher Code Generation

When an Order Created Event occurs, the Order Operation Service listens for it and goes through this workflow to validate the vouchers and generate voucher codes for them:

  1. VoucherCodeGenerationOrderCreatedListener receives the order created event, validates the Order#vouchers and then generate voucher codes for them, and sends the event to the VoucherGenerationCompletionProducer.CHANNEL channel with the Order.

    1. The vouchers are validated using OfferProvider

    2. If the vouchers are still valid, it will generate voucher codes using CampaignProvider.

      1. If the CodeGenerationResult is successful, generated voucher codes will be set onto the vouchers

      2. If the CodeGenerationResult is not successful, an error will be logged and set onto the vouchers. The VoucherGenerationCompletionEvent will still be sent

  2. A VoucherGenerationCompletion message is published, containing the order that has the vouchers.