Application to manage payments and clients.
GET /api/payments/4
- Laravel Framework version
9.19
. - PHP version
8.1.4
.
- Installing the php dependencies.
composer install
-
Copy the
.env.example
file and save it as.env
. -
Set the
APP_KEY
value in your.env
file.
php artisan key:generate
- Run the migrations and seeders. There is a seeder to fill the table of fake clients.
php artisan migrate --seed
- Set the username and password to use mailtrap in your
.env
file.
...
MAIL_USERNAME="your-username"
MAIL_PASSWORD="your-password"
...
- Process the "payment" queue.
php artisan queue:work --queue=payment
- It is recommended to run to list the failed jobs
php artisan queue:failed
-
GET /api/clients
-
GET /api/payments/{id}
-
POST /api/payments
Required fields
- payment_date: Date in the format: Y-m-d
- expires_at: Date in the format: Y-m-d
- client_id: Id of a valid client. For example: 1 to 5.
Note: Save the payment details with pending status. Add the payment to the "payment" queue to process it. Raise an event to send an email with the payment notification.
\app\Models\Api\Client
\app\Models\Api\Payment
\app\Models\Api\Dollar
resources\Views\Emails\show
\app\Api\PaymentController
\app\Api\ClientController
app\Jobs\ProcessPayment
\app\Events\PaymentCreated
\app\Listeners\PaymentNotification
\database\Factories\Api\ClientFactory
\app\Observers\Api\PaymentObserver
\app\Enums\PaymentStatus
\app\Services\DollarService
app\Http\Resources\PaymentResource
Rafael Delgado. [email protected]