Handle payment processor webhooks #3003

Opend-okafor wants to merge 2 commits into main from fix/processor-webhooks· opened 3 days ago
+58−0
d-okafor commented 3 days agoAuthor

Why

We poll the processor every 5 minutes to learn that a payment succeeded. Customers see "pending" for too long and support gets tickets. The processor can push events to us instead.

What

  • New ProcessorEvent model that records every event we receive
  • POST /api/webhooks/processor: verifies the HMAC signature, skips events we already stored, then marks the payment captured or failed and sends the receipt email

The router is deliberately unauthenticated (auth=None) because the processor cannot hold one of our tokens; the HMAC is the authentication.

Testing

Replayed three sandbox events with curl, including one duplicate.

d-okafor added 2 commits 3 days ago
Add ProcessorEvent modelc02db8d
Add processor webhook endpointbf2db74

Review required

Review the changes, then submit to get graded.

Some checks haven’t completed yet

1 check: dojo / review-grader

Keyboard shortcuts

Site-wide

Focus the search bar
/
Show this dialog
?

Pull request

Move to the next file
j
Move to the previous file
k
Filter changed files
t
Comment on the selected lines
c
Select a range of lines
Shiftclick