Package com.homannsoftware.transactions
Class CheckoutService
java.lang.Object
com.homannsoftware.transactions.CheckoutService
Defines the transaction boundary for one local checkout use case.
-
Constructor Summary
ConstructorsConstructorDescriptionCheckoutService(CheckoutRepository repository) Creates the service through constructor injection. -
Method Summary
-
Constructor Details
-
CheckoutService
Creates the service through constructor injection.- Parameters:
repository- SQL adapter using the same DataSource
-
-
Method Details
-
checkout
Reserves inventory and records an order as one atomic database change.- Parameters:
orderRef- nonblank reference of at most 80 characterssku- nonblank product identifier of at most 40 charactersquantity- positive number of units- Throws:
IllegalArgumentException- if an argument is invalidOutOfStockException- if the product is missing or insufficient
-