Skip to content

Qaali21/Negash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

👥 Contributors

NatiDevHQ
Negash Bekele
eyob-030
eyob-030
berry-k0
berry-k0
Lu121921
Lu121921
HayatGharad09
HayatGharad09
fiwori
fiwori

🛒 BANKING SYSTEM

📌 Before You Start

  1. Ensure backend is running at http://localhost:5000
  2. Install Postman (or use any API testing tool)
  3. Set up environment:
    • Create variable base_url = http://localhost:5000

🔐 Authentication APIs

1. Register User

POST {{base_url}}/api/auth/register
Content-Type: application/json

{
  "username": "testuser",
  "email": "test@example.com",
  "password": "Test@1234"
}

Expected Response (201 Created):

{
  "message": "User registered successfully"
}

2. Login User

POST {{base_url}}/api/auth/login
Content-Type: application/json

{
    "email": "test@example.com",
  "password": "Test@1234"
}

Expected Response (200 OK):

{
  "token": "eyJhbGciOi...",
  "userId": 1,
  "username": "testuser"
}

💡 Save the token for authenticated requests!

📦 Product APIs

3. Get All Products

GET {{base_url}}/api/products

Expected Response (200 OK):

[
  {
    "id": 1,
    "name": "iPhone 13",
    "price": 999.99,
    "category": "Electronics"
  }
]

4. Get Single Product

GET {{base_url}}/api/products/1

Expected Response (200 OK):

{
  "id": 1,
  "name": "iPhone 13",
  "description": "Latest smartphone",
  "price": 999.99,
  "category": "Electronics"
}

🛍️ Cart APIs

5. Add to Cart (Authenticated)

POST {{base_url}}/api/cart
Authorization: Bearer {{token}}
Content-Type: application/json

{
  "productId": 1,
  "quantity": 2
}

Expected Response (200 OK):

{
  "message": "Product added to cart"
}

6. View Cart (Authenticated)

GET {{base_url}}/api/cart
Authorization: Bearer {{token}}

Expected Response (200 OK):

[
  {
    "productId": 1,
    "name": "iPhone 13",
    "price": 999.99,
    "quantity": 2
  }
]

💳 Order APIs

7. Create Order (Authenticated)

POST {{base_url}}/api/orders
Authorization: Bearer {{token}}
Content-Type: application/json

{
  "shippingInfo": {
    "address": "123 Main St",
    "city": "New York"
  },
  "paymentMethod": "credit_card"
}

Expected Response (201 Created):

{
  "orderId": 1,
  "message": "Order created successfully"
}

8. View Orders (Authenticated)

GET {{base_url}}/api/orders
Authorization: Bearer {{token}}

Expected Response (200 OK):

[
  {
    "id": 1,
    "total": 1999.98,
    "status": "pending",
    "items": [
      {
        "productId": 1,
        "name": "iPhone 13",
        "quantity": 2
      }
    ]
  }
]

🧪 Test Cases to Verify Group

Happy Path Tests:

  1. Register → Login → Add to Cart → Create Order → View Orders
  2. Browse products without login
  3. Update cart quantities

new added things on the test:

  1. logout
  2. me
  3. upload img

Error Cases:

  1. Register with existing username (should fail)
  2. Add invalid product to cart (should fail)
  3. Checkout with empty cart (should fail)

for the front-end visit this github here:-https://github.com/eyob-030/E-commerce-Frontend

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors