- Create the .env file and make sure the WWWUSER and WWWGROUP is set correctly, For ubuntu it is 1000 for both
cp .env.example .env
- Run the following docker command to install sail to your project.
docker run --rm \ -u "$(id -u):$(id -g)" \ -v "$(pwd):/var/www/html" \ -w /var/www/html \ laravelsail/php81-composer:latest \ composer install --ignore-platform-reqs
- Start the docker compose containers via sail:
./vendor/bin/sail up -d
Create billing system for selling products in the monthly subscription model.
Customer
- person (first name, last name, email) who can purchase an product in the subscription modelProduct
- product with a description, price. Product can be deactivatedSubscription
- Monthly subscription only, can be paused. Single customer can subscribe multiple products, but only one of the same type. System should bill customer every single month on the same day when subscription was started without overflow (let's say the subscription was started at 31 May, then following should be 30 June, 31 July etc.)Transaction
- Information about payment transaction (date, amount, status: failed/succeeded). Failed transaction should be retried day after
- Create API Endpoint
/api/customer
to register customer - Create API Endpoint
/api/product
to list products - Create API Endpoint
/api/subscription
to list own subscriptions and make new subscription - Create API Endpoint
/api/transaction
to list the billing history - Create and cronjob running every minute to handle the payments and simulate payment gateway with 80% succeeded and 20% failed transactions.
- Create database migrations and seeders
- Implement
\App\Component\Billing\DueDateCalculator
class, should pass\Tests\Unit\DueDateCalculatorTest
test - Feature tests
tests/Feature
should pass - Write PHPUnit tests