Taghunter98 / JavaGo

0 stars 0 forks source link

Complete Order Class #4

Open Taghunter98 opened 4 days ago

Taghunter98 commented 4 days ago

Ticket Title: Complete Order Class for Item Ordering and Checkout System

Priority: High

Description: This ticket focuses on completing the implementation of the Order class within the JavaGo package. The goal is to finalise the order workflow, including item selection, basket management, checkout, and payment processing.

Related Issue: #Order-Class-Development (link to the corresponding issue)

Current State:

Tasks:

  1. Order Number Generation:

    • Implement a method to generate a random orderNumber. The format should resemble something like ORD123456.
  2. Server Name Input:

    • Prompt the user to enter the server's name, which will be displayed on the receipt.
  3. Payment Process:

    • Add a method for handling payment where the user is asked to input payment details (you can mock the payment process).
    • Ensure the paymentSuccess boolean is updated based on the user’s response or mock validation.
  4. Receipt Generation:

    • Once the payment is successful, print a receipt that includes:
      • User's name and order number.
      • List of all items ordered, along with prices.
      • Total price.
      • Server name.
      • Payment confirmation status.
    • Format the receipt clearly using the Terminal.printHeader() method for a structured view.
  5. Error Handling:

    • Handle cases where the user enters an invalid item name.
    • Handle invalid input for returning to the menu or proceeding to checkout.
    • Ensure that invalid input for payment is managed, and the user can retry.
  6. Code Refactoring:

    • Move some logic (e.g., checking if an item exists) into separate helper methods to make the order method cleaner and easier to maintain.

Acceptance Criteria:

Test Plan:

Taghunter98 commented 22 hours ago

Changes