Add partial and full refund endpoint for card payments #2001

Openkeiko-tanaka wants to merge 3 commits into main from feat/payment-refunds· opened 2 days ago
+71−1
keiko-tanaka commented 2 days agoAuthor

Why

Merchants currently email support to refund a card payment and we click the button in the gateway dashboard by hand. This adds a self-serve endpoint.

What

  • POST /payments/{payment_id}/refunds refunds the full remaining amount, or amount if given.
  • Rejects refunds larger than what is still refundable.
  • Records a Refund row and bumps payment.refunded_amount.

Testing

Added a test for a partial refund. Also ran a full refund against the gateway sandbox.

keiko-tanaka added 3 commits 2 days ago
Add refund schemasb737067
Add refund endpointb837080
Register refunds router and add testb937099

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