Skip to main content

Discount Service

The discount service provides the bounded context Discount. It is responsible for managing discounts, coupons, and their usages by users.

Domain Model​

info

Imported entities from other bounded contexts are marked with a dashed border.

Technology Stack​

  • Language: Kotlin
  • Framework: Spring Boot
  • GraphQL Library: GraphQL Kotlin
  • Database: PostgreSQL
  • Schema Management: Flyway

Events​

This section lists events that are defined or used by the discount service.

Published Events​

discount/discount/created​

This event is published when a new discount is created.

{
id: string,
discount: number,
maxUsagesperUser?: number,
validUntil: string,
validFrom: string,
minOrderAmount?: number,
discountAppliesToCategoryIds: string[],
discountAppliesToProductIds: string[],
discountAppliesToProductVariantIds: string[]
}

discount/discount/updated​

This event is published when a discount is updated.

{
id: string,
discount: number,
maxUsagesperUser?: number,
validUntil: string,
validFrom: string,
minOrderAmount?: number,
discountAppliesToCategoryIds: string[],
discountAppliesToProductIds: string[],
discountAppliesToProductVariantIds: string[]
}

discount/coupon/created​

This event is published when a new coupon is created.

{
id: string,
code: string,
discountId: string,
maxUsages: number,
validUntil: string,
validFrom: string
}

discount/coupon/updated​

This event is published when a coupon is updated.

{
id: string,
code: string,
discountId: string,
maxUsages: number,
validUntil: string,
validFrom: string
}

discount/order/validation-succeeded​

This event is thrown when the validation of an order caused by inventory/product-item/reservation-succeeded (TODO link) is successful.

{
order: Order;
}

discount/order/validation-failed​

This event is thrown when the validation of an order caused by inventory/product-item/reservation-succeeded (TODO link) is not successful.

{
order: Order,
failingDiscountIds: string[]
}

Subscribed Events​