# oktocode-l-l-c/sham-cash-php-sdk architecture

> Architecture diagram of the GitHub repository oktocode-l-l-c/sham-cash-php-sdk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oktocode-l-l-c/sham-cash-php-sdk
- Repository: https://github.com/oktocode-l-l-c/sham-cash-php-sdk
- Video tour (about a minute): https://gitdiagram.com/oktocode-l-l-c/sham-cash-php-sdk/video

## Overview

This is a PHP SDK for the ShamCash payment API. The main workflow is an application calling the SDK to create, retrieve, or refund bills and list transactions; the client validates and encrypts requests, transport sends them to ShamCash, and response mapping returns typed results. Separately, ShamCash posts encrypted webhook bodies to the application, which the SDK decrypts, validates timestamps, and maps into a notification. The graph also shows pagination and supporting crypto, mapping, and transport layers. Relationships are grounded in the README and shown source; unsampled components are included only where documented capabilities and paths are clear.

Main entry points: [`src/Support/ResponseMapper.php`](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Support/ResponseMapper.php) (Response mapper), [`src/Http/Transport.php`](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Http/Transport.php) (HTTP transport), [`src/Client.php`](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Client.php) (SDK client), [`src/Crypto/DirectJwe.php`](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Crypto/DirectJwe.php) (Direct JWE)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["SDK operations"]
  node_client["SDK client<br/>[Client.php]"]
  node_bills["Bill operations<br/>[Client.php]"]
  node_refunds["Refund operation<br/>[Client.php]"]
  node_transactions["Transaction queries<br/>[Client.php]"]
  node_pagination["Transaction iteration<br/>[Client.php]"]
  node_webhook["Webhook parsing<br/>[Client.php]"]
end

subgraph group_wire["API and cryptography"]
  node_transport["HTTP transport<br/>[Transport.php]"]
  node_jwe["Direct JWE<br/>[DirectJwe.php]"]
end

subgraph group_domain["Payment models"]
  node_bill["Bill result<br/>[Bill.php]"]
  node_refund_result["Refund result<br/>[RefundResult.php]"]
  node_transaction_page["Transaction page"]
  node_transaction["Transaction<br/>[Transaction.php]"]
  node_notification["Webhook notification"]
  node_refund["Refund entry<br/>[Refund.php]"]
  node_status["Bill statuses<br/>[BillStatus.php]"]
  node_currency["Currencies<br/>[Currency.php]"]
  node_result_code["API result codes<br/>[ResultCode.php]"]
  node_transaction_type["Transaction types"]
end

subgraph group_support["Shared support"]
  node_mapper["Response mapper<br/>[ResponseMapper.php]"]
  node_json["JSON support<br/>[Json.php]"]
  node_input["Input validation<br/>[Input.php]"]
  node_decimal["Decimal amounts<br/>[DecimalValue.php]"]
  node_clock["Clock<br/>[Clock.php]"]
  node_exceptions["SDK exceptions"]
  node_api_exception["API exception<br/>[ApiException.php]"]
  node_transport_exception["Transport exception"]
  node_crypto_exception["Crypto exception"]
  node_fields["Field extraction<br/>[Fields.php]"]
end

node_app(("PHP application"))
node_shamcash{{"ShamCash API"}}

node_app -->|"calls"| node_client
node_client -->|"exposes"| node_bills
node_client -->|"exposes"| node_refunds
node_client -->|"exposes"| node_transactions
node_client -->|"exposes"| node_pagination
node_client -->|"exposes"| node_webhook
node_bills -->|"validates"| node_input
node_refunds -->|"validates"| node_input
node_transactions -->|"validates"| node_input
node_bills -->|"formats amounts"| node_decimal
node_refunds -->|"formats amounts"| node_decimal
node_bills -->|"encrypts payload"| node_jwe
node_refunds -->|"encrypts payload"| node_jwe
node_transactions -->|"encrypts payload"| node_jwe
node_bills -->|"posts request"| node_transport
node_refunds -->|"posts request"| node_transport
node_transactions -->|"posts request"| node_transport
node_transport -->|"sends HTTP"| node_shamcash
node_shamcash -->|"returns response"| node_transport
node_transport -->|"decodes response"| node_json
node_transport -->|"raises API errors"| node_api_exception
node_transport -->|"raises transport errors"| node_transport_exception
node_transport -->|"checks result"| node_result_code
node_bills -->|"maps response"| node_mapper
node_refunds -->|"maps response"| node_mapper
node_transactions -->|"maps response"| node_mapper
node_mapper -->|"builds"| node_bill
node_mapper -->|"builds"| node_refund_result
node_mapper -->|"builds"| node_transaction_page
node_mapper -->|"builds"| node_transaction
node_mapper -->|"builds"| node_refund
node_mapper -->|"builds"| node_notification
node_mapper -->|"extracts fields"| node_fields
node_mapper -->|"maps status"| node_status
node_mapper -->|"maps currency"| node_currency
node_mapper -->|"maps type"| node_transaction_type
node_pagination -->|"requests pages"| node_transactions
node_pagination -->|"reads cursor"| node_transaction_page
node_app -->|"passes raw body"| node_webhook
node_webhook -->|"decodes envelope"| node_json
node_webhook -->|"decrypts token"| node_jwe
node_webhook -->|"checks timestamps"| node_clock
node_webhook -->|"maps notification"| node_mapper
node_shamcash -->|"posts webhook"| node_app
node_notification -->|"returns event"| node_app
node_bill -->|"uses status"| node_status
node_bill -->|"uses currency"| node_currency
node_transaction -->|"uses currency"| node_currency

click node_client "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Client.php"
click node_bills "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Client.php"
click node_refunds "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Client.php"
click node_transactions "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Client.php"
click node_pagination "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Client.php"
click node_webhook "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Client.php"
click node_transport "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Http/Transport.php"
click node_jwe "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Crypto/DirectJwe.php"
click node_mapper "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Support/ResponseMapper.php"
click node_json "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Support/Json.php"
click node_input "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Support/Input.php"
click node_decimal "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Support/DecimalValue.php"
click node_clock "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Support/Clock.php"
click node_bill "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Model/Bill.php"
click node_refund_result "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Model/RefundResult.php"
click node_transaction_page "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Model/TransactionPage.php"
click node_transaction "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Model/Transaction.php"
click node_notification "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Model/WebhookNotification.php"
click node_refund "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Model/Refund.php"
click node_status "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Enum/BillStatus.php"
click node_currency "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Enum/Currency.php"
click node_result_code "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Enum/ResultCode.php"
click node_transaction_type "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Enum/TransactionType.php"
click node_exceptions "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Exception/ShamCashException.php"
click node_api_exception "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Exception/ApiException.php"
click node_transport_exception "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Exception/TransportException.php"
click node_crypto_exception "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Exception/CryptoException.php"
click node_fields "https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Support/Fields.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_client,node_bills,node_refunds,node_transactions,node_pagination,node_webhook toneBlue
class node_transport,node_jwe toneAmber
class node_bill,node_refund_result,node_transaction_page,node_transaction,node_notification,node_refund,node_status,node_currency,node_result_code,node_transaction_type,node_shamcash toneMint
class node_mapper,node_json,node_input,node_decimal,node_clock,node_exceptions,node_api_exception,node_transport_exception,node_crypto_exception,node_fields toneRose
class node_app toneIndigo
```

## Components

### SDK operations

- [SDK client](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Client.php): `src/Client.php`
- [Bill operations](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Client.php): `src/Client.php`
- [Refund operation](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Client.php): `src/Client.php`
- [Transaction queries](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Client.php): `src/Client.php`
- [Transaction iteration](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Client.php): `src/Client.php`
- [Webhook parsing](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Client.php): `src/Client.php`

### API and cryptography

- [HTTP transport](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Http/Transport.php): `src/Http/Transport.php`
- [Direct JWE](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Crypto/DirectJwe.php): `src/Crypto/DirectJwe.php`

### Payment models

- [Bill result](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Model/Bill.php): `src/Model/Bill.php`
- [Refund result](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Model/RefundResult.php): `src/Model/RefundResult.php`
- [Transaction page](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Model/TransactionPage.php): `src/Model/TransactionPage.php`
- [Transaction](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Model/Transaction.php): `src/Model/Transaction.php`
- [Webhook notification](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Model/WebhookNotification.php): `src/Model/WebhookNotification.php`
- [Refund entry](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Model/Refund.php): `src/Model/Refund.php`
- [Bill statuses](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Enum/BillStatus.php): `src/Enum/BillStatus.php`
- [Currencies](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Enum/Currency.php): `src/Enum/Currency.php`
- [API result codes](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Enum/ResultCode.php): `src/Enum/ResultCode.php`
- [Transaction types](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Enum/TransactionType.php): `src/Enum/TransactionType.php`

### Shared support

- [Response mapper](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Support/ResponseMapper.php): `src/Support/ResponseMapper.php`
- [JSON support](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Support/Json.php): `src/Support/Json.php`
- [Input validation](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Support/Input.php): `src/Support/Input.php`
- [Decimal amounts](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Support/DecimalValue.php): `src/Support/DecimalValue.php`
- [Clock](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Support/Clock.php): `src/Support/Clock.php`
- [SDK exceptions](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Exception/ShamCashException.php): `src/Exception/ShamCashException.php`
- [API exception](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Exception/ApiException.php): `src/Exception/ApiException.php`
- [Transport exception](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Exception/TransportException.php): `src/Exception/TransportException.php`
- [Crypto exception](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Exception/CryptoException.php): `src/Exception/CryptoException.php`
- [Field extraction](https://github.com/oktocode-l-l-c/sham-cash-php-sdk/blob/master/src/Support/Fields.php): `src/Support/Fields.php`

### Other components

- **PHP application**
- **ShamCash API**

## Connections

- PHP application → SDK client: calls (evidence: `README.md`)
- SDK client → Bill operations: exposes (evidence: `src/Client.php`)
- SDK client → Refund operation: exposes (evidence: `src/Client.php`)
- SDK client → Transaction queries: exposes (evidence: `src/Client.php`)
- SDK client → Transaction iteration: exposes (evidence: `src/Client.php`)
- SDK client → Webhook parsing: exposes (evidence: `src/Client.php`)
- Bill operations → Input validation: validates (evidence: `src/Client.php`)
- Refund operation → Input validation: validates (evidence: `src/Client.php`)
- Transaction queries → Input validation: validates (evidence: `src/Client.php`)
- Bill operations → Decimal amounts: formats amounts (evidence: `src/Client.php`)
- Refund operation → Decimal amounts: formats amounts (evidence: `src/Client.php`)
- Bill operations → Direct JWE: encrypts payload (evidence: `src/Client.php`)
- Refund operation → Direct JWE: encrypts payload (evidence: `src/Client.php`)
- Transaction queries → Direct JWE: encrypts payload (evidence: `src/Client.php`)
- Bill operations → HTTP transport: posts request (evidence: `src/Client.php`)
- Refund operation → HTTP transport: posts request (evidence: `src/Client.php`)
- Transaction queries → HTTP transport: posts request (evidence: `src/Client.php`)
- HTTP transport → ShamCash API: sends HTTP (evidence: `src/Http/Transport.php`)
- ShamCash API → HTTP transport: returns response (evidence: `README.md`)
- HTTP transport → JSON support: decodes response (evidence: `src/Http/Transport.php`)
- HTTP transport → API exception: raises API errors (evidence: `src/Http/Transport.php`)
- HTTP transport → Transport exception: raises transport errors (evidence: `src/Http/Transport.php`)
- HTTP transport → API result codes: checks result (evidence: `src/Http/Transport.php`)
- Bill operations → Response mapper: maps response (evidence: `src/Client.php`)
- Refund operation → Response mapper: maps response (evidence: `src/Client.php`)
- Transaction queries → Response mapper: maps response (evidence: `src/Client.php`)
- Response mapper → Bill result: builds (evidence: `src/Support/ResponseMapper.php`)
- Response mapper → Refund result: builds (evidence: `src/Support/ResponseMapper.php`)
- Response mapper → Transaction page: builds (evidence: `src/Support/ResponseMapper.php`)
- Response mapper → Transaction: builds (evidence: `src/Support/ResponseMapper.php`)
- Response mapper → Refund entry: builds (evidence: `src/Support/ResponseMapper.php`)
- Response mapper → Webhook notification: builds (evidence: `src/Support/ResponseMapper.php`)
- Response mapper → Field extraction: extracts fields (evidence: `src/Support/ResponseMapper.php`)
- Response mapper → Bill statuses: maps status (evidence: `src/Support/ResponseMapper.php`)
- Response mapper → Currencies: maps currency (evidence: `src/Support/ResponseMapper.php`)
- Response mapper → Transaction types: maps type (evidence: `src/Support/ResponseMapper.php`)
- Transaction iteration → Transaction queries: requests pages (evidence: `src/Client.php`)
- Transaction iteration → Transaction page: reads cursor (evidence: `src/Client.php`)
- PHP application → Webhook parsing: passes raw body (evidence: `README.md`)
- Webhook parsing → JSON support: decodes envelope (evidence: `src/Client.php`)
- Webhook parsing → Direct JWE: decrypts token (evidence: `src/Client.php`)
- Webhook parsing → Clock: checks timestamps (evidence: `src/Client.php`)
- Webhook parsing → Response mapper: maps notification (evidence: `src/Client.php`)
- ShamCash API → PHP application: posts webhook (evidence: `README.md`)
- Webhook notification → PHP application: returns event (evidence: `README.md`)
- Bill result → Bill statuses: uses status (evidence: `src/Model/Bill.php`)
- Bill result → Currencies: uses currency (evidence: `src/Model/Bill.php`)
- Transaction → Currencies: uses currency (evidence: `src/Model/Transaction.php`)
