Skip to content

Instantly share code, notes, and snippets.

@Muzammil-Bilwani
Created July 26, 2024 14:06
Show Gist options
  • Save Muzammil-Bilwani/5f2c7adadf01a4134a17b7d7240de754 to your computer and use it in GitHub Desktop.
Save Muzammil-Bilwani/5f2c7adadf01a4134a17b7d7240de754 to your computer and use it in GitHub Desktop.
API Practice Tasks

Node.js API Tasks for Bill Splitting

Task 1: Basic Bill Splitting

Create an endpoint to split a bill evenly among a group of users.

  • Endpoint: /split-evenly
  • Method: POST
  • Input: List of user IDs and total bill amount.
  • Output: Amount each user needs to pay.

Task 2: Uneven Bill Splitting

Create an endpoint to split a bill unevenly based on individual contributions.

  • Endpoint: /split-unevenly
  • Method: POST
  • Input: List of user IDs, their respective contributions, and the total bill amount.
  • Output: Amount each user needs to pay or receive.

Task 3: Including Tip and Tax

Create an endpoint to split a bill including tip and tax evenly among users.

  • Endpoint: /split-including-tip-tax
  • Method: POST
  • Input: List of user IDs, total bill amount, tip percentage, and tax percentage.
  • Output: Amount each user needs to pay including tip and tax.

Task 4: Handling Discounts

Create an endpoint to apply a discount to the total bill before splitting it evenly among users.

  • Endpoint: /split-with-discount
  • Method: POST
  • Input: List of user IDs, total bill amount, and discount percentage.
  • Output: Amount each user needs to pay after discount.

Task 5: Advanced Bill Splitting with Shared Items

Create an endpoint to split a bill where some items are shared among certain users.

  • Endpoint: /split-with-shared-items
  • Method: POST
  • Input: List of user IDs, list of items with prices, and list of user IDs for each shared item.
  • Output: Amount each user needs to pay.

Task 6: IOUs and Balances

Create an endpoint to manage IOUs (I Owe You) between users after splitting a bill.

  • Endpoint: /manage-ious
  • Method: POST
  • Input: List of transactions indicating who owes whom and how much.
  • Output: Updated balances for each user.

Task 7: Bill Splitting History

Create an endpoint to fetch the history of bill splitting transactions for a user.

  • Endpoint: /user-bill-history
  • Method: GET
  • Input: User ID
  • Output: List of past bill splitting transactions involving the user.

Task 8: Notifications

Create an endpoint to send notifications to users about their share of the bill.

  • Endpoint: /notify-users
  • Method: POST
  • Input: List of user IDs, total bill amount, and breakdown of amounts each user needs to pay.
  • Output: Success or failure message.

Task 9: Currency Conversion

Create an endpoint to handle bill splitting among users with different currencies.

  • Endpoint: /split-with-currency-conversion
  • Method: POST
  • Input: List of user IDs, their respective currencies, total bill amount, and exchange rates.
  • Output: Amount each user needs to pay in their respective currencies.

Task 10: Group Bill Splitting Summary

Create an endpoint to generate a summary report for a group after splitting a bill.

  • Endpoint: /group-summary
  • Method: POST
  • Input: List of user IDs and total bill amount.
  • Output: Detailed summary including individual amounts, shared items, and any adjustments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment