# andevarteaga/pasarela-de-pago-multi-metodos architecture

> Architecture diagram of the GitHub repository andevarteaga/pasarela-de-pago-multi-metodos, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/andevarteaga/pasarela-de-pago-multi-metodos
- Repository: https://github.com/andevarteaga/pasarela-de-pago-multi-metodos

## Overview

Pasarela is an isolated payment gateway: a customer enters through a signed checkout link, reviews and submits a payment, and receives a payment result; the gateway charges through Wompi and notifies the originating product. The documented product also includes origin/product administration, webhook handling, subscription billing and lifecycle operations, and email delivery. The graph combines documented capabilities with visible source references; some subsystem links are documented rather than verified from complete endpoint or worker implementations.

Main entry points: [`src/Pasarela.Api/Endpoints/HttpApi.cs`](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Endpoints/HttpApi.cs) (HTTP API), [`src/Pasarela.Api/Services/Workers.cs`](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Services/Workers.cs) (Billing and outbox workers), [`src/Pasarela.Api/Data/AppDb.cs`](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Data/AppDb.cs) (Database access), [`src/Pasarela.Api/Services/ChargeService.cs`](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Services/ChargeService.cs) (Charge processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Checkout frontend"]
  node_browser["Checkout application<br/>[App.tsx]"]
  node_pay["Payment form<br/>[Pay.tsx]"]
  node_status_pages["Wait and receipt pages<br/>[Wait.tsx]"]
  node_cancel_page["Cancel page<br/>[Cancel.tsx]"]
  node_web_api["Browser API client<br/>[api.ts]"]
  node_wompi_token["Card tokenization<br/>[wompi.ts]"]
end

subgraph group_api["API and checkout"]
  node_http_api["HTTP API<br/>[HttpApi.cs]"]
  node_checkout["Charge processing<br/>[ChargeService.cs]"]
  node_rules["Payment and billing rules<br/>[Rules.cs]"]
  node_admin["Origin and product admin<br/>[HttpApi.cs]"]
end

subgraph group_lifecycle["Payment lifecycle"]
  node_transitions["Payment transitions"]
  node_workers["Billing and outbox workers<br/>[Workers.cs]"]
  node_email["Email rendering<br/>[EmailHtml.cs]"]
end

subgraph group_integrations["Persistence and integrations"]
  node_entities["Payment domain records<br/>[Entities.cs]"]
  node_db_context["Database access<br/>[AppDb.cs]"]
  node_wompi_client["Wompi client<br/>[WompiClient.cs]"]
end

node_customer(("Customer"))
node_postgres[("PostgreSQL")]
node_wompi["Wompi"]
node_origin["Origin product"]
node_resend["Resend"]

node_customer -->|"opens checkout"| node_browser
node_browser -->|"routes to"| node_pay
node_browser -->|"routes to"| node_status_pages
node_browser -->|"routes to"| node_cancel_page
node_pay -->|"requests session and payment"| node_web_api
node_pay -->|"tokenizes card"| node_wompi_token
node_status_pages -->|"fetches payment status"| node_web_api
node_status_pages -->|"fetches receipt"| node_web_api
node_web_api -->|"calls checkout API"| node_http_api
node_http_api -->|"starts charges"| node_checkout
node_http_api -->|"applies payment state"| node_transitions
node_http_api -->|"handles bank and webhook flows"| node_wompi_client
node_http_api -->|"reads and writes"| node_db_context
node_http_api -->|"serves admin operations"| node_admin
node_checkout -->|"reads and writes"| node_db_context
node_checkout -->|"submits charges"| node_wompi_client
node_checkout -->|"records charge result"| node_transitions
node_transitions -->|"persists transitions"| node_db_context
node_transitions -.->|"applies billing rules"| node_rules
node_workers -->|"processes stored work"| node_db_context
node_workers -->|"submits renewals"| node_checkout
node_workers -->|"reconciles payments"| node_transitions
node_workers -->|"renders email"| node_email
node_workers -->|"sends email"| node_resend
node_workers -->|"delivers notifications"| node_origin
node_wompi_client -->|"calls payment API"| node_wompi
node_wompi -->|"posts webhook"| node_http_api
node_db_context -->|"stores payment data"| node_postgres
node_db_context -->|"maps records"| node_entities

click node_browser "https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/web/src/App.tsx"
click node_pay "https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/web/src/Pay.tsx"
click node_status_pages "https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/web/src/Wait.tsx"
click node_cancel_page "https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/web/src/Cancel.tsx"
click node_web_api "https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/web/src/api.ts"
click node_wompi_token "https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/web/src/wompi.ts"
click node_http_api "https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Endpoints/HttpApi.cs"
click node_checkout "https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Services/ChargeService.cs"
click node_rules "https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Domain/Rules.cs"
click node_admin "https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Endpoints/HttpApi.cs"
click node_transitions "https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Services/TransitionService.cs"
click node_workers "https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Services/Workers.cs"
click node_email "https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Services/EmailHtml.cs"
click node_entities "https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Data/Entities.cs"
click node_db_context "https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Data/AppDb.cs"
click node_wompi_client "https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Services/WompiClient.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_browser,node_pay,node_status_pages,node_cancel_page,node_web_api,node_wompi_token toneBlue
class node_http_api,node_checkout,node_rules,node_admin,node_postgres toneAmber
class node_transitions,node_workers,node_email toneMint
class node_entities,node_db_context,node_wompi_client toneRose
class node_customer,node_wompi,node_origin,node_resend toneIndigo
```

## Components

### Checkout frontend

- [Checkout application](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Payment form](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/web/src/Pay.tsx): `web/src/Pay.tsx`
- [Wait and receipt pages](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/web/src/Wait.tsx): `web/src/Wait.tsx`
- [Cancel page](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/web/src/Cancel.tsx): `web/src/Cancel.tsx`
- [Browser API client](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/web/src/api.ts): `web/src/api.ts`
- [Card tokenization](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/web/src/wompi.ts): `web/src/wompi.ts`

### API and checkout

- [HTTP API](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Endpoints/HttpApi.cs): `src/Pasarela.Api/Endpoints/HttpApi.cs`
- [Charge processing](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Services/ChargeService.cs): `src/Pasarela.Api/Services/ChargeService.cs`
- [Payment and billing rules](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Domain/Rules.cs): `src/Pasarela.Api/Domain/Rules.cs`
- [Origin and product admin](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Endpoints/HttpApi.cs): `src/Pasarela.Api/Endpoints/HttpApi.cs`

### Payment lifecycle

- [Payment transitions](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Services/TransitionService.cs): `src/Pasarela.Api/Services/TransitionService.cs`
- [Billing and outbox workers](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Services/Workers.cs): `src/Pasarela.Api/Services/Workers.cs`
- [Email rendering](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Services/EmailHtml.cs): `src/Pasarela.Api/Services/EmailHtml.cs`

### Persistence and integrations

- [Payment domain records](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Data/Entities.cs): `src/Pasarela.Api/Data/Entities.cs`
- [Database access](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Data/AppDb.cs): `src/Pasarela.Api/Data/AppDb.cs`
- [Wompi client](https://github.com/andevarteaga/pasarela-de-pago-multi-metodos/blob/main/src/Pasarela.Api/Services/WompiClient.cs): `src/Pasarela.Api/Services/WompiClient.cs`

### Other components

- **Customer**
- **PostgreSQL**
- **Wompi**
- **Origin product**
- **Resend**

## Connections

- Customer → Checkout application: opens checkout (evidence: `README.md`)
- Checkout application → Payment form: routes to (evidence: `web/src/App.tsx`)
- Checkout application → Wait and receipt pages: routes to (evidence: `web/src/App.tsx`)
- Checkout application → Cancel page: routes to (evidence: `web/src/App.tsx`)
- Payment form → Browser API client: requests session and payment (evidence: `web/src/Pay.tsx`)
- Payment form → Card tokenization: tokenizes card (evidence: `web/src/Pay.tsx`)
- Wait and receipt pages → Browser API client: fetches payment status (evidence: `web/src/Wait.tsx`)
- Wait and receipt pages → Browser API client: fetches receipt (evidence: `web/src/Wait.tsx`)
- Browser API client → HTTP API: calls checkout API (evidence: `web/src/api.ts`)
- HTTP API → Charge processing: starts charges (evidence: `src/Pasarela.Api/Endpoints/HttpApi.cs`)
- HTTP API → Payment transitions: applies payment state (evidence: `src/Pasarela.Api/Endpoints/HttpApi.cs`)
- HTTP API → Wompi client: handles bank and webhook flows (evidence: `src/Pasarela.Api/Endpoints/HttpApi.cs`)
- HTTP API → Database access: reads and writes (evidence: `src/Pasarela.Api/Endpoints/HttpApi.cs`)
- HTTP API → Origin and product admin: serves admin operations (evidence: `README.md`)
- Charge processing → Database access: reads and writes (evidence: `src/Pasarela.Api/Services/ChargeService.cs`)
- Charge processing → Wompi client: submits charges (evidence: `src/Pasarela.Api/Services/ChargeService.cs`)
- Charge processing → Payment transitions: records charge result (evidence: `src/Pasarela.Api/Services/ChargeService.cs`)
- Payment transitions → Database access: persists transitions (evidence: `src/Pasarela.Api/Services/TransitionService.cs`)
- Payment transitions → Payment and billing rules: applies billing rules
- Billing and outbox workers → Database access: processes stored work (evidence: `src/Pasarela.Api/Services/Workers.cs`)
- Billing and outbox workers → Charge processing: submits renewals (evidence: `src/Pasarela.Api/Services/Workers.cs`)
- Billing and outbox workers → Payment transitions: reconciles payments (evidence: `src/Pasarela.Api/Services/Workers.cs`)
- Billing and outbox workers → Email rendering: renders email (evidence: `src/Pasarela.Api/Services/Workers.cs`)
- Billing and outbox workers → Resend: sends email (evidence: `src/Pasarela.Api/Services/Workers.cs`)
- Billing and outbox workers → Origin product: delivers notifications (evidence: `README.md`)
- Wompi client → Wompi: calls payment API (evidence: `src/Pasarela.Api/Services/WompiClient.cs`)
- Wompi → HTTP API: posts webhook (evidence: `README.md`)
- Database access → PostgreSQL: stores payment data (evidence: `README.md`)
- Database access → Payment domain records: maps records (evidence: `src/Pasarela.Api/Data/AppDb.cs`)
