-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat : adds endpoint to create order
- Loading branch information
1 parent
d6379c4
commit d351233
Showing
7 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
retail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/order/Address.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.example.retailstore.webapp.clients.order; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import java.io.Serializable; | ||
|
||
public record Address( | ||
@NotBlank(message = "AddressLine1 is required") String addressLine1, | ||
String addressLine2, | ||
@NotBlank(message = "City is required") String city, | ||
@NotBlank(message = "State is required") String state, | ||
@NotBlank(message = "ZipCode is required") String zipCode, | ||
@NotBlank(message = "Country is required") String country) | ||
implements Serializable {} |
13 changes: 13 additions & 0 deletions
13
...webapp/src/main/java/com/example/retailstore/webapp/clients/order/CreateOrderRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.example.retailstore.webapp.clients.order; | ||
|
||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.NotEmpty; | ||
import jakarta.validation.constraints.Positive; | ||
import java.io.Serializable; | ||
import java.util.List; | ||
|
||
public record CreateOrderRequest( | ||
@NotEmpty(message = "Items cannot be empty.") List<OrderItemRequest> items, | ||
@Positive Long customerId, | ||
@Valid Address deliveryAddress) | ||
implements Serializable {} |
3 changes: 3 additions & 0 deletions
3
...bapp/src/main/java/com/example/retailstore/webapp/clients/order/OrderConfirmationDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.example.retailstore.webapp.clients.order; | ||
|
||
public record OrderConfirmationDTO(String orderNumber, OrderStatus status) {} |
5 changes: 5 additions & 0 deletions
5
...e-webapp/src/main/java/com/example/retailstore/webapp/clients/order/OrderItemRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.example.retailstore.webapp.clients.order; | ||
|
||
import java.math.BigDecimal; | ||
|
||
public record OrderItemRequest(String productCode, int quantity, BigDecimal productPrice) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...-store-webapp/src/main/java/com/example/retailstore/webapp/clients/order/OrderStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.example.retailstore.webapp.clients.order; | ||
|
||
public enum OrderStatus { | ||
NEW, | ||
IN_PROCESS, | ||
DELIVERED, | ||
CANCELLED, | ||
ERROR | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters