Shipment Service
The shipment service provides the bounded context Shipment.
It is responsible for managing shipments and their state, and interacts with an external shipment provider to do so.
Domain Model
Imported entities from other bounded contexts are marked with a dashed border.
REST API
The service provides a REST API which is used by the external shipment provider to inform about shipment status changes.
POST /shipment/{id}/status
Updates the status of a shipment.
Body
{
status: ShipmentStatus;
}
enum ShipmentStatus {
PENDING,
IN_PROGRESS,
DELIVERED,
FAILED
}
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 shipment service.
Published Events
shipment/shipment/created
This event is published when a new shipment is created.
{
id: string,
orderId?: string,
returnId?: string,
status: ShipmentStatus,
orderItemIds: string[],
shipmentMethodId: string,
shipmentAddressId: string
}
shipment/shipment/creation-failed
This event is published when the creation of a shipment failed.
{
orderId?: string,
returnId?: string,
orderItemIds: string[],
shipmentMethodId: string,
shipmentAddressId: string,
reason: string
}
shipment/shipment/status-updated
This event is published when the status of a shipment is updated.
{
id: string,
orderId?: string,
returnId?: string,
status: ShipmentStatus,
orderItemIds: string[],
}
shipment/shipment-method/created
This event is published when a new shipment method is created.
{
id: string,
name: string,
description: string,
ref: string,
baseFees: number,
feesPerItem: number,
feesPerKg: number
}
shipment/shipment-method/archived
This event is published when a shipment method is archived.
{
id: string;
}
Subscribed Events
- payment/payment/payment-enabled: Used to create new shipments for an order when the order and associated payment is validated successfully.
- address/user-address/created: Used to import
UserAddressfrom theAddressbounded context. - address/vendor-address/created: Used to import
VendorAddressfrom theAddressbounded context. - catalog/product-variant-version/created: Used to import
ProductVariantVersionfrom theCatalogbounded context. - return/return/created: Used to create a shipment for a return.