Class CustomerApplicationService
java.lang.Object
com.example.orderplatform.customers.application.CustomerApplicationService
- All Implemented Interfaces:
CustomerDirectory
@Service
@Transactional
public class CustomerApplicationService
extends Object
implements CustomerDirectory
Application service that registers customers and backs the customer lookup module API.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateCustomer(String fullName, String email) Registers a new active customer after normalizing and validating the submitted identity fields.getRequiredCustomer(UUID customerId) Retrieves the customer snapshot required by order placement.
-
Constructor Details
-
CustomerApplicationService
-
-
Method Details
-
createCustomer
Registers a new active customer after normalizing and validating the submitted identity fields.- Parameters:
fullName- customer display nameemail- customer email address- Returns:
- created customer snapshot
- Throws:
ResourceConflictException- when another customer already uses the email address
-
getRequiredCustomer
Retrieves the customer snapshot required by order placement.- Specified by:
getRequiredCustomerin interfaceCustomerDirectory- Parameters:
customerId- customer identifier- Returns:
- immutable customer snapshot
- Throws:
ResourceNotFoundException- when the customer does not exist
-