Discount Service
The discount service provides the bounded context Discount.
It is responsible for managing discounts, coupons, and their usages by users.
Domain Model
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
- inventory/product-item/reservation-succeeded: Causes a validation of the order to check if the discounts can still be applied.
- user/user/created: Used to import
Userfrom theUserbounded context. - catalog/category/created: Used to import
Categoryfrom theCategorybounded context. - catalog/product/created: Used to import
Productfrom theCatalogbounded context. - catalog/product-variant/created: Used to import
ProductVariantfrom theCatalogbounded context.