# biztecheg/laravel-fawaterk architecture

> Architecture diagram of the GitHub repository biztecheg/laravel-fawaterk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/biztecheg/laravel-fawaterk
- Repository: https://github.com/biztecheg/laravel-fawaterk

## Overview

Laravel Fawaterk is a payment-gateway integration centered on taking a payment and deciding safely when an order is paid. An application supplies a payable order; checkout creates or reuses a gateway transaction, and the payer returns through a result page. Separately, signed webhooks trigger authoritative transaction rereads, ledger checks and payment events; reconciliation repairs missed or delayed updates and tracks refunds. The graph preserves these documented capabilities, including profiles and anomaly alerts. Some relationships are based on README or SOURCE INDEX references because their implementations were not excerpted.

Main entry points: [`src/Reconcile/Reconciler.php`](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Reconcile/Reconciler.php) (Reconciler), [`src/Http/Controllers/ResultController.php`](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Http/Controllers/ResultController.php) (Result endpoint), [`src/Http/Client.php`](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Http/Client.php) (HTTP client), [`src/Contracts/FawaterkClient.php`](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Contracts/FawaterkClient.php) (Gateway client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_checkout["Checkout"]
  node_checkout_service["Checkout service"]
  node_checkout_profiles["Checkout profiles<br/>[Profile.php]"]
  node_checkout_data["Transaction data"]
end

subgraph group_gateway["Gateway access"]
  node_client_contract["Gateway client<br/>[FawaterkClient.php]"]
  node_http_client["HTTP client<br/>[Client.php]"]
  node_credentials["Account credentials"]
  node_access_tokens["Access tokens"]
end

subgraph group_payment_integrity["Payment integrity"]
  node_webhook_controller["Webhook endpoint"]
  node_signature_verifier["Signature verifier"]
  node_webhook_processor["Webhook processor"]
  node_payment_recorder["Payment recorder"]
  node_ledger[("Payment ledger")]
  node_webhook_events[("Webhook event log<br/>[WebhookEvent.php]")]
end

subgraph group_operations["Operations"]
  node_reconciler["Reconciler<br/>[Reconciler.php]"]
  node_refund_watcher["Refund watcher<br/>[RefundWatcher.php]"]
  node_anomaly_alerts["Anomaly alerts<br/>[AnomalyMailer.php]"]
end

subgraph group_results["Payer results"]
  node_result_controller["Result endpoint"]
  node_result_page["Result page<br/>[ResultPage.php]"]
  node_result_views["Result views<br/>[show.blade.php]"]
end

node_app(("Merchant application"))
node_payer(("Payer"))
node_fawaterk{{"Fawaterk API"}}

node_app -->|"starts checkout"| node_checkout_service
node_checkout_service -.->|"selects profile"| node_checkout_profiles
node_checkout_service -->|"builds request"| node_checkout_data
node_checkout_service -->|"creates transaction"| node_client_contract
node_client_contract -->|"implemented by"| node_http_client
node_http_client -->|"gets token"| node_access_tokens
node_http_client -->|"uses credentials"| node_credentials
node_http_client -->|"sends API requests"| node_fawaterk
node_fawaterk -->|"returns transaction data"| node_http_client
node_fawaterk -->|"posts webhook"| node_webhook_controller
node_webhook_controller -->|"verifies payload"| node_signature_verifier
node_webhook_controller -->|"processes verified event"| node_webhook_processor
node_webhook_controller -->|"records outcome"| node_webhook_events
node_webhook_processor -->|"rereads transaction"| node_client_contract
node_webhook_processor -->|"applies payment update"| node_payment_recorder
node_payment_recorder -->|"updates locked rows"| node_ledger
node_payment_recorder -.->|"reports anomalies"| node_anomaly_alerts
node_app -->|"schedules reconciliation"| node_reconciler
node_reconciler -->|"rereads transactions"| node_client_contract
node_reconciler -->|"records updates"| node_payment_recorder
node_reconciler -->|"checks refunds"| node_refund_watcher
node_reconciler -.->|"resends alerts"| node_anomaly_alerts
node_payer -->|"returns to result"| node_result_controller
node_result_controller -->|"finds payment"| node_ledger
node_result_controller -->|"may reread transaction"| node_client_contract
node_result_controller -->|"builds display data"| node_result_page
node_result_controller -->|"renders result"| node_result_views

click node_checkout_service "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Checkout/CheckoutService.php"
click node_checkout_profiles "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Checkout/Profile.php"
click node_checkout_data "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Data/CreateTransaction.php"
click node_client_contract "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Contracts/FawaterkClient.php"
click node_http_client "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Http/Client.php"
click node_credentials "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Accounts/AccountRepository.php"
click node_access_tokens "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Auth/AccessTokenProvider.php"
click node_webhook_controller "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Http/Controllers/WebhookController.php"
click node_signature_verifier "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Webhooks/SignatureVerifier.php"
click node_webhook_processor "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Webhooks/WebhookProcessor.php"
click node_payment_recorder "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Ledger/PaymentRecorder.php"
click node_ledger "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Ledger/FawaterkPayment.php"
click node_webhook_events "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Webhooks/WebhookEvent.php"
click node_reconciler "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Reconcile/Reconciler.php"
click node_refund_watcher "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Refunds/RefundWatcher.php"
click node_anomaly_alerts "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Notifications/AnomalyMailer.php"
click node_result_controller "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Http/Controllers/ResultController.php"
click node_result_page "https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Results/ResultPage.php"
click node_result_views "https://github.com/biztecheg/laravel-fawaterk/blob/main/resources/views/results/show.blade.php"

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_checkout_service,node_checkout_profiles,node_checkout_data toneBlue
class node_client_contract,node_http_client,node_credentials,node_access_tokens toneAmber
class node_webhook_controller,node_signature_verifier,node_webhook_processor,node_payment_recorder,node_ledger,node_webhook_events,node_fawaterk toneMint
class node_reconciler,node_refund_watcher,node_anomaly_alerts toneRose
class node_result_controller,node_result_page,node_result_views,node_app,node_payer toneIndigo
```

## Components

### Checkout

- [Checkout service](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Checkout/CheckoutService.php): `src/Checkout/CheckoutService.php`
- [Checkout profiles](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Checkout/Profile.php): `src/Checkout/Profile.php`
- [Transaction data](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Data/CreateTransaction.php): `src/Data/CreateTransaction.php`

### Gateway access

- [Gateway client](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Contracts/FawaterkClient.php): `src/Contracts/FawaterkClient.php`
- [HTTP client](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Http/Client.php): `src/Http/Client.php`
- [Account credentials](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Accounts/AccountRepository.php): `src/Accounts/AccountRepository.php`
- [Access tokens](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Auth/AccessTokenProvider.php): `src/Auth/AccessTokenProvider.php`

### Payment integrity

- [Webhook endpoint](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Http/Controllers/WebhookController.php): `src/Http/Controllers/WebhookController.php`
- [Signature verifier](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Webhooks/SignatureVerifier.php): `src/Webhooks/SignatureVerifier.php`
- [Webhook processor](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Webhooks/WebhookProcessor.php): `src/Webhooks/WebhookProcessor.php`
- [Payment recorder](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Ledger/PaymentRecorder.php): `src/Ledger/PaymentRecorder.php`
- [Payment ledger](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Ledger/FawaterkPayment.php): `src/Ledger/FawaterkPayment.php`
- [Webhook event log](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Webhooks/WebhookEvent.php): `src/Webhooks/WebhookEvent.php`

### Operations

- [Reconciler](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Reconcile/Reconciler.php): `src/Reconcile/Reconciler.php`
- [Refund watcher](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Refunds/RefundWatcher.php): `src/Refunds/RefundWatcher.php`
- [Anomaly alerts](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Notifications/AnomalyMailer.php): `src/Notifications/AnomalyMailer.php`

### Payer results

- [Result endpoint](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Http/Controllers/ResultController.php): `src/Http/Controllers/ResultController.php`
- [Result page](https://github.com/biztecheg/laravel-fawaterk/blob/main/src/Results/ResultPage.php): `src/Results/ResultPage.php`
- [Result views](https://github.com/biztecheg/laravel-fawaterk/blob/main/resources/views/results/show.blade.php): `resources/views/results/show.blade.php`

### Other components

- **Merchant application**
- **Payer**
- **Fawaterk API**

## Connections

- Merchant application → Checkout service: starts checkout
- Checkout service → Checkout profiles: selects profile (evidence: `src/Checkout/CheckoutService.php`)
- Checkout service → Transaction data: builds request (evidence: `src/Checkout/CheckoutService.php`)
- Checkout service → Gateway client: creates transaction (evidence: `src/Checkout/CheckoutService.php`)
- Gateway client → HTTP client: implemented by (evidence: `src/Http/Client.php`)
- HTTP client → Access tokens: gets token (evidence: `src/Http/Client.php`)
- HTTP client → Account credentials: uses credentials (evidence: `src/Http/Client.php`)
- HTTP client → Fawaterk API: sends API requests (evidence: `src/Http/Client.php`)
- Fawaterk API → HTTP client: returns transaction data
- Fawaterk API → Webhook endpoint: posts webhook
- Webhook endpoint → Signature verifier: verifies payload (evidence: `src/Http/Controllers/WebhookController.php`)
- Webhook endpoint → Webhook processor: processes verified event (evidence: `src/Http/Controllers/WebhookController.php`)
- Webhook endpoint → Webhook event log: records outcome (evidence: `src/Http/Controllers/WebhookController.php`)
- Webhook processor → Gateway client: rereads transaction (evidence: `src/Webhooks/WebhookProcessor.php`)
- Webhook processor → Payment recorder: applies payment update (evidence: `src/Webhooks/WebhookProcessor.php`)
- Payment recorder → Payment ledger: updates locked rows (evidence: `src/Ledger/PaymentRecorder.php`)
- Payment recorder → Anomaly alerts: reports anomalies
- Merchant application → Reconciler: schedules reconciliation
- Reconciler → Gateway client: rereads transactions (evidence: `src/Reconcile/Reconciler.php`)
- Reconciler → Payment recorder: records updates (evidence: `src/Reconcile/Reconciler.php`)
- Reconciler → Refund watcher: checks refunds (evidence: `src/Reconcile/Reconciler.php`)
- Reconciler → Anomaly alerts: resends alerts
- Payer → Result endpoint: returns to result
- Result endpoint → Payment ledger: finds payment (evidence: `src/Http/Controllers/ResultController.php`)
- Result endpoint → Gateway client: may reread transaction (evidence: `src/Http/Controllers/ResultController.php`)
- Result endpoint → Result page: builds display data (evidence: `src/Http/Controllers/ResultController.php`)
- Result endpoint → Result views: renders result (evidence: `src/Http/Controllers/ResultController.php`)
