Skip to content

Implement Create Order API #14

@heymaaz

Description

@heymaaz
  • Create Order entities
  • Create POST /api/orders API to create a new order
  • Create SecurityService to return a dummy login user for now
  • Unit and Integration Tests for POST /api/orders API

Request:

{
    "customer" : {
        "name": "Siva",
        "email": "siva@gmail.com",
        "phone": "999999999"
    },
    "deliveryAddress" : {
        "addressLine1": "Birkelweg",
        "addressLine2": "Hans-Edenhofer-Straße 23",
        "city": "Berlin",
        "state": "Berlin",
        "zipCode": "94258",
        "country": "Germany"
    },
    "items": [
        {
            "code": "P100",
            "name": "Product 1",
            "price": 25.50,
            "quantity": 1
        }
    ]
}

Responses:

HTTP Status: 201 Created

{
    "orderNumber": "ORD-1"
}

HTTP Status: 400 if the product code is invalid or the price is not match with catalog service.

{
    "type": "https://api.sivalabs-bookstore.com/errors/invalid-order-request",
    "title": "Invalid Product Code",
    "status": 400,
    "detail": "Product with code P100 not found",
    "instance": "/api/orders",
    "timestamp": "2024-03-29T01:18:05.728560591Z"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions