# ssheduardo/redsys-laravel architecture

> Architecture diagram of the GitHub repository ssheduardo/redsys-laravel, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ssheduardo/redsys-laravel
- Repository: https://github.com/ssheduardo/redsys-laravel

## Overview

##### Project Type Analysis
This is a Laravel package that serves as a wrapper/integration for the Redsys payment gateway service. It's primarily a middleware component that facilitates communication between Laravel applications and the Redsys payment processing system.

##### Main Components

a. Core Components:
- Laravel Application (Host Application)
- Redsys Laravel Package
- Redsys Payment Gateway (External Service)

b. Package Internal Structure:
- Service Provider
- Facade
- Configuration Layer

- [Laravel Application] --> [Redsys Laravel Package] --> [Redsys Payment Gateway]

##### Package Internal Structure
- [Redsys Laravel Package]
- RedsysServiceProvider
- Redsys Facade
- Configuration

##### Data Flow Elements
- Payment Request Flow
- Notification Handling
- Response Processing

##### Specific Design Elements

- Blue: Laravel Application components
- Green: Package components
- Red: External services (Redsys Gateway)
- Yellow: Configuration elements

Interactions:
- Merchant parameter flow
- Signature generation/verification
- Notification handling
- Success/Failure redirects

##### Key Technical Aspects to Highlight

a. Integration Points:
- Configuration injection points
- Service provider registration
- Facade accessibility

b. Security Layer:
- HMAC_SHA256_V1 signature generation
- Merchant validation
- Secure communication channels

##### Implementation Details

- Transaction Parameter Setting
- Signature Generation
- Form Generation
- Response Handling
- Notification Processing

##### Environment Handling
A switch mechanism showing:
- Test Environment
- Production Environment

##### Response handling mechanisms

Use these symbols:
- Double lines for secure communications
- Diamonds for decision points

- Component types
- Environment indicators

Keep the abstraction level focused on:
- Service integration points
- Security mechanisms
- Configuration management
- Payment flow

- How the package integrates with Laravel
- The security measures in place
- The configuration requirements
- The complete payment flow process

Remember to include notes about:
- Required configuration settings
- Environment-specific behaviors
- Security considerations
- Response handling mechanisms

This will provide a comprehensive view of how the package operates within the Laravel ecosystem while maintaining security and reliability in payment processing.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Laravel Application"
        LA[Laravel App]
        Config[Configuration]
    end

    subgraph "Redsys Laravel Package"
        SP["Service Provider"]:::provider
        RF["Redsys Facade"]:::facade
        CL["Configuration Layer"]:::config
        
        subgraph "Core Components"
            TP["Transaction Parameters"]
            SG["Signature Generator"]
            FG["Form Generator"]
            RH["Response Handler"]
            NP["Notification Processor"]
        end
    end

    subgraph "External Services"
        RPG["Redsys Payment Gateway"]:::external
    end

    subgraph "Environment"
        TS["Test Server"]:::env
        PS["Production Server"]:::env
    end

    %% Connections
    LA --> SP
    LA --> RF
    SP --> CL
    RF --> TP
    RF --> SG
    RF --> FG
    RF --> RH
    RF --> NP
    
    TP --> SG
    SG --> FG
    FG --> RPG
    RPG --> RH
    RPG --> NP
    
    RPG --> TS
    RPG --> PS

    %% Styles
    classDef provider fill:#a8d5ff
    classDef facade fill:#95ff95
    classDef config fill:#ffe066
    classDef external fill:#ff9999
    classDef env fill:#e6e6e6

    %% Click events
    click SP "https://github.com/ssheduardo/redsys-laravel/blob/master/src/RedsysServiceProvider.php"
    click RF "https://github.com/ssheduardo/redsys-laravel/blob/master/src/Facades/Redsys.php"
    click CL "https://github.com/ssheduardo/redsys-laravel/blob/master/src/config/config.php"
    click TP "https://github.com/ssheduardo/redsys-laravel/tree/master/src/"
    click SG "https://github.com/ssheduardo/redsys-laravel/tree/master/src/"
    click FG "https://github.com/ssheduardo/redsys-laravel/tree/master/src/"
    click RH "https://github.com/ssheduardo/redsys-laravel/tree/master/src/"
    click NP "https://github.com/ssheduardo/redsys-laravel/tree/master/src/"

    %% Legend
    subgraph Legend
        L1["Service Provider"]:::provider
        L2["Facade"]:::facade
        L3["Configuration"]:::config
        L4["External Service"]:::external
        L5["Environment"]:::env
    end
```
