Skip to content

API created in Laravel to manage clients and their payments.

Notifications You must be signed in to change notification settings

rafael1delgado/laravel-payments-client

Repository files navigation

Laravel Payments & Clients

Application to manage payments and clients.

GET /api/payments/4

Preview Laravel Payments and Clients

Requirements

  • Laravel Framework version 9.19.
  • PHP version 8.1.4.

Installing

  1. Installing the php dependencies.
composer install
  1. Copy the .env.example file and save it as .env.

  2. Set the APP_KEY value in your .env file.

php artisan key:generate
  1. Run the migrations and seeders. There is a seeder to fill the table of fake clients.
php artisan migrate --seed
  1. Set the username and password to use mailtrap in your .env file.
...
MAIL_USERNAME="your-username"
MAIL_PASSWORD="your-password"
...
  1. Process the "payment" queue.
php artisan queue:work --queue=payment
  1. It is recommended to run to list the failed jobs
php artisan queue:failed

Endpoints

  • 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.

Important files

Models

  • \app\Models\Api\Client
  • \app\Models\Api\Payment
  • \app\Models\Api\Dollar

Views

  • resources\Views\Emails\show

Controllers

  • \app\Api\PaymentController
  • \app\Api\ClientController

Jobs

  • app\Jobs\ProcessPayment

Events

  • \app\Events\PaymentCreated

Listeners

  • \app\Listeners\PaymentNotification

Factories

  • \database\Factories\Api\ClientFactory

Observers

  • \app\Observers\Api\PaymentObserver

Enums

  • \app\Enums\PaymentStatus

Services

  • \app\Services\DollarService

Resources

  • app\Http\Resources\PaymentResource

Credits

Rafael Delgado. [email protected]

About

API created in Laravel to manage clients and their payments.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages