← 返回 stripe 的题目列表Invoice Management System with CRUD Operations and Efficient Retrieval
类型:online_judge
stripe
Design an invoice generation system by implementing a function. In this system, users can:
Create an invoice with a unique ID, customer information, and a list of items. Each item in the list includes a name, quantity, and unit price.
Update an existing invoice's information, including customer information and the list of items.
Delete an invoice.
Retrieve an invoice's details based on its ID.
Use appropriate data structures to ensure the efficiency of all operations. Test cases include:
Creating an invoice and retrieving it
Updating an invoice and retrieving it
Deleting an invoice and making sure retrieval fails
Updating and deleting non-existent invoices to test error handling
Assume the number of items in the item list will not exceed 1000 and the total number of invoices will not exceed 10000.
Example
Input
1
{"customer": "Customer A", "items": [{"name": "Item1", "quantity": 1, "price": 10}]}