Skip to content

feat: donation.confirmed webhook delivery (#76)#77

Merged
ayshadogo merged 1 commit into
Dfunder:mainfrom
NteinPrecious:feature/issue-76-donation-confirmation-webhook
Jun 22, 2026
Merged

feat: donation.confirmed webhook delivery (#76)#77
ayshadogo merged 1 commit into
Dfunder:mainfrom
NteinPrecious:feature/issue-76-donation-confirmation-webhook

Conversation

@NteinPrecious

Copy link
Copy Markdown
Contributor

Summary

Implements issue #76 — emit an HTTP POST webhook whenever a donation is confirmed on-chain.

Changes

  • src/webhooks/donation_confirmed.rsDonationConfirmedPayload struct (serializes to the required JSON shape) and deliver() async function that POSTs the payload to the configured URL with up to 3 retries (500 ms delay between attempts) on non-2xx responses or network errors.
  • src/webhooks/mod.rs — module entry point re-exporting public items.
  • src/config.rs — added optional webhook_url: Option<String> field read from the WEBHOOK_URL env var; missing/empty value disables delivery.
  • .env.example — documents the new WEBHOOK_URL variable.
  • src/main.rs — wired pub mod webhooks.

Payload

{
  "event": "donation.confirmed",
  "tx_hash": "...",
  "campaign_id": "...",
  "donor_address": "...",
  "amount": 5000,
  "timestamp": "2026-06-21T17:44:34Z"
}

Testing

  • 2 new unit tests: payload JSON serialization and error message format.
  • All 65 tests pass (cargo test).

Closes #76

- Add src/webhooks/donation_confirmed.rs with DonationConfirmedPayload
  struct and deliver() async fn that POSTs to WEBHOOK_URL on confirmation
- Retry delivery up to 3 times (500ms delay) on non-2xx or network error
- Add optional webhook_url field to Config, read from WEBHOOK_URL env var
- Document WEBHOOK_URL in .env.example
- Wire pub mod webhooks into main.rs
- 2 new unit tests: payload serialization and error message format

Closes Dfunder#76

@ayshadogo ayshadogo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Job well done Boss

@ayshadogo ayshadogo merged commit 530c326 into Dfunder:main Jun 22, 2026
2 checks passed
@grantfox-oss grantfox-oss Bot mentioned this pull request Jun 22, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Donation Confirmation Webhook

2 participants