{"id":28820479,"url":"https://github.com/victorlga/payment-webhook-handler","last_synced_at":"2026-06-23T08:31:05.442Z","repository":{"id":297686896,"uuid":"996354571","full_name":"victorlga/payment-webhook-handler","owner":"victorlga","description":"A Clojure webhook handler for processing and validating payment events with SQLite persistence and HTTP callbacks for confirmation/cancellation.","archived":false,"fork":false,"pushed_at":"2025-06-09T23:50:53.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-18T21:46:18.624Z","etag":null,"topics":["backend","clojure","functional-programming","payment","webhook"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/victorlga.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-04T20:38:43.000Z","updated_at":"2025-06-09T23:50:56.000Z","dependencies_parsed_at":"2025-06-06T21:29:37.426Z","dependency_job_id":null,"html_url":"https://github.com/victorlga/payment-webhook-handler","commit_stats":null,"previous_names":["victorlga/payment-webhook-handler"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/victorlga/payment-webhook-handler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorlga%2Fpayment-webhook-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorlga%2Fpayment-webhook-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorlga%2Fpayment-webhook-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorlga%2Fpayment-webhook-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/victorlga","download_url":"https://codeload.github.com/victorlga/payment-webhook-handler/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorlga%2Fpayment-webhook-handler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34682622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","clojure","functional-programming","payment","webhook"],"created_at":"2025-06-18T21:44:24.133Z","updated_at":"2026-06-23T08:31:05.430Z","avatar_url":"https://github.com/victorlga.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧾 Payment Webhook Handler\n\nA Clojure webhook handler for processing and validating payment events with SQLite persistence and HTTP callbacks for confirmation/cancellation.\n\n## 📦 Features\n\n* Validates a secure token from incoming webhooks\n* Checks for duplicate or malformed payloads\n* Confirms or cancels transactions via internal HTTP APIs\n* Persists transaction IDs in an SQLite database\n* Supports both HTTP (port 5000) and HTTPS (port 5443)\n\n---\n\n## 🚀 Getting Started\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/victorlga/payment-webhook-handler.git\ncd payment-webhook-handler\n```\n\nThis project will run a HTTPS server locally. To make this possible, you need to generate a self-signed certificate. Run the following command **in the root of the repository** to create a `keystore.p12` file:\n\n```bash\nkeytool -genkeypair -alias server-key \\\n  -keyalg RSA -keysize 2048 -storetype PKCS12 \\\n  -keystore keystore.p12 -validity 365 \\\n  -storepass changeit -keypass changeit \\\n  -dname \"CN=localhost, OU=Dev, O=MyCompany, L=City, S=State, C=BR\"\n```\n\n\u003e This creates a self-signed certificate valid for 365 days, with both the store and key passwords set to `changeit`.\n\n### 2. Build Docker Image\n\nMake sure Docker is running:\n\n```bash\ndocker build -t clojure-webhook-handler -f .devcontainer/Dockerfile .\n```\n\n### 3. Run the Server\n\nIf ports `5000` (HTTP) or `5443` (HTTPS) are in use, **change the exposed ports**.\n\n```bash\ndocker run -p 5000:5000 -p 5443:5443 clojure-webhook-handler\n```\n\nFor example, if port `5000` is busy and you want to use port `5050` instead:\n\n```bash\ndocker run -p 5050:5000 -p 5443:5443 clojure-webhook-handler\n```\n\nYou should see something like:\n\n```\nSLF4J: Failed to load class \"org.slf4j.impl.StaticLoggerBinder\".\nSLF4J: Defaulting to no-operation (NOP) logger implementation\n...\n```\n\n---\n\n## 🧪 Testing the Webhook\n\n### 1. Navigate to the Python Test Script\n\n```bash\ncd python\n```\n\n### 2. Set Up Python Environment\n\n```bash\npython3 -m venv venv\nsource venv/bin/activate\npip install -r requirements.txt\n```\n\n### 3. Run the Test\n\n```bash\npython3 test_webhook.py\n```\n\n\u003e ⚠️ If you changed the port during Docker run, make sure to update it in `test_webhook.py`.\n\n### ✅ Verifying HTTPS is Working\n\nOnce the server is running with HTTPS (on port `5443` by default), test it using `curl`:\n\n```bash\ncurl -k -X POST https://localhost:5443/webhook \\\n  -H \"Content-Type: application/json\" \\\n  -H \"x-webhook-token: meu-token-secreto\" \\\n  -d '{\"transaction_id\": \"test-123\", \"event\": \"payment\", \"amount\": \"49.90\", \"currency\": \"BRL\", \"timestamp\": \"2025-06-08T12:00:00Z\"}'\n```\n\n* The `-k` flag allows `curl` to skip certificate verification (necessary for self-signed certs).\n* You should receive a response like `\"OK\"` if the request is accepted.\n\n### ⚠️ Important Notes\n\n* This `curl` request **only validates the HTTPS interface**.\n* The internal HTTP requests to confirm or cancel the transaction **will fail**, because `curl` doesn't run the backend services required to handle those endpoints (`/confirmar`, `/cancelar`).\n* This is expected during basic HTTPS testing.\n\n---\n\n## 📁 Project Structure\n\n```\n.\n├── core.clj              ; Main handler logic\n├── project.clj           ; Leiningen config\n├── .devcontainer/\n│   └── Dockerfile        ; Docker setup\n├── data/                 ; SQLite database\n└── python/\n    ├── test_webhook.py   ; Test client for webhook\n    └── requirements.txt  ; Python dependencies\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorlga%2Fpayment-webhook-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvictorlga%2Fpayment-webhook-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorlga%2Fpayment-webhook-handler/lists"}