Include letter text in user-facing order API responses.
Users need the full message on Mina beställningar after creating an order. The admin API already exposed letterText; user list and payment confirm endpoints did not. - Add letterText field to OrderResponse DTO - Map letterText in OrderController.toResponse and PaymentController.toResponse - Assert letterText in OrderControllerTest list and create expectations
This commit is contained in:
parent
0e7dbb915e
commit
e2bccb4029
4 changed files with 5 additions and 0 deletions
|
|
@ -61,6 +61,7 @@ public class OrderController {
|
|||
return new OrderResponse(
|
||||
order.getId(),
|
||||
order.getPlate(),
|
||||
order.getLetterText(),
|
||||
order.getStatus().getValue(),
|
||||
order.getTrackingId(),
|
||||
order.getAmountPaid(),
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ public class PaymentController {
|
|||
return new OrderResponse(
|
||||
order.getId(),
|
||||
order.getPlate(),
|
||||
order.getLetterText(),
|
||||
order.getStatus().getValue(),
|
||||
order.getTrackingId(),
|
||||
order.getAmountPaid(),
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import java.util.UUID;
|
|||
public record OrderResponse(
|
||||
UUID id,
|
||||
String plate,
|
||||
String letterText,
|
||||
String status,
|
||||
String trackingId,
|
||||
BigDecimal amountPaid,
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ class OrderControllerTest {
|
|||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$[0].id").value("c1eebc99-9c0b-4ef8-bb6d-6bb9bd380a11"))
|
||||
.andExpect(jsonPath("$[0].plate").value("ABC123"))
|
||||
.andExpect(jsonPath("$[0].letterText").value("Test letter"))
|
||||
.andExpect(jsonPath("$[0].status").value("sent"))
|
||||
.andExpect(jsonPath("$[0].trackingId").value("PN123456789"));
|
||||
}
|
||||
|
|
@ -130,6 +131,7 @@ class OrderControllerTest {
|
|||
.andExpect(status().isCreated())
|
||||
.andExpect(jsonPath("$.id").value("d1eebc99-9c0b-4ef8-bb6d-6bb9bd380a11"))
|
||||
.andExpect(jsonPath("$.plate").value("ABC123"))
|
||||
.andExpect(jsonPath("$.letterText").value("Hej fin bil!"))
|
||||
.andExpect(jsonPath("$.status").value("pending_payment"));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue