{"id":22107486,"url":"https://github.com/nextyfine-dev/electronics-store","last_synced_at":"2025-03-24T03:22:18.467Z","repository":{"id":182266772,"uuid":"667522542","full_name":"nextyfine-dev/electronics-store","owner":"nextyfine-dev","description":"This repository contains a Node.js application that implements a checkout system for an electronics store. The application allows scanning items and calculating the total price based on specific pricing rules.","archived":false,"fork":false,"pushed_at":"2023-07-19T09:43:55.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-29T09:36:59.655Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nextyfine-dev.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-17T17:41:03.000Z","updated_at":"2023-07-17T17:44:02.000Z","dependencies_parsed_at":"2023-07-19T11:00:55.519Z","dependency_job_id":null,"html_url":"https://github.com/nextyfine-dev/electronics-store","commit_stats":null,"previous_names":["nextyfine-dev/electronics-store"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextyfine-dev%2Felectronics-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextyfine-dev%2Felectronics-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextyfine-dev%2Felectronics-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextyfine-dev%2Felectronics-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nextyfine-dev","download_url":"https://codeload.github.com/nextyfine-dev/electronics-store/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245201233,"owners_count":20576781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-01T08:17:49.470Z","updated_at":"2025-03-24T03:22:18.437Z","avatar_url":"https://github.com/nextyfine-dev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Checkout system for an electronics store.\n\nThis repository contains a Node.js application that implements a checkout system for an electronics store. The application allows scanning items and calculating the total price based on specific pricing rules.\n\n## Features\n\n- Scanning items: The `scan(item)` method allows you to add items to the checkout system.\n- Calculating total price: The `total()` method calculates the total price of all scanned items, considering the specified pricing rules.\n- Pricing rules: The pricing rules define the SKU, name, price, and any applicable discounts for each product.\n\n## Getting Started\n\nFollow the instructions below to set up and run the application:\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/nextyfine-dev/electronics-store.git\n   ```\n\n2. Install dependencies:\\*\\*\n\n   ```bash\n   yarn install\n   ```\n\n3. Set up pricing rules:\n\n   Modify the `app.ts` file to define the pricing rules for your products. Each pricing rule should include the SKU, name, price, and any applicable discounts.\n\n4. Run the application:\n\n```bash\nyarn start\n```\n\n```bash\nyarn run build\n```\n\n```bash\nyarn run dev\n```\n\n## Code Structure\n\n- `Checkout.ts`: Contains the implementation of the `Checkout` class, which handles the scanning of items and calculating the total price.\n- `app.ts`: Entry point of the application where you can define the pricing rules and test the checkout system.\n- `interfaces.ts`: Defines the `PricingRule` interface used to specify the pricing rules for the products.\n\n## Usage\n\nTo use the checkout system, follow these steps:\n\n1. Create an instance of the `Checkout` class by providing the pricing rules.\n2. Use the `scan(item)` method to add items to the checkout system.\n3. Call the `total()` method to calculate the total price of all scanned items.\n\n```typescript\nimport Checkout from \"./Checkout.js\";\nimport { PricingRule } from \"./interfaces\";\n\nconst pricingRules: PricingRule[] = [\n  // Define pricing rules for your products\n];\n\nconst co = new Checkout(pricingRules);\nco.scan(\"item1\");\nco.scan(\"item2\");\nconst total = co.total();\nconsole.log(\"Total:\", total);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextyfine-dev%2Felectronics-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnextyfine-dev%2Felectronics-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextyfine-dev%2Felectronics-store/lists"}