Skip to content

fix(api): Catch StripeException in RefundPaymentAsync [AB#288]#295

Merged
bllr777 merged 1 commit into
mainfrom
feature/288-fix-stripe-refund-exception-handling
May 17, 2026
Merged

fix(api): Catch StripeException in RefundPaymentAsync [AB#288]#295
bllr777 merged 1 commit into
mainfrom
feature/288-fix-stripe-refund-exception-handling

Conversation

@bllr777
Copy link
Copy Markdown
Collaborator

@bllr777 bllr777 commented May 17, 2026

Summary

Fixes Stripe refund errors being silently swallowed by the global error middleware. StripePaymentProcessor.RefundPaymentAsync now catches StripeException and returns a PaymentOperationResult failure with the actual Stripe error message, which the controller already surfaces as a 400 BadRequest.

Type of Change

  • Bug fix

Changes

API

  • StripePaymentProcessor.RefundPaymentAsync — wrapped
    efundService.CreateAsync in ry/catch(StripeException). Returns { Success = false, Message = ex.StripeError?.Message ?? ex.Message } instead of propagating to middleware.

Testing

  • Build passes (0 errors, 0 warnings)
  • Manual testing performed against staging

Work Item

Closes AB#288 — child of User Story #281

Checklist

  • Self-review performed
  • No new lint warnings introduced
  • Tests pass locally

StripePaymentProcessor.RefundPaymentAsync previously let StripeException propagate to ErrorHandlingMiddleware, which converted every Stripe error into a generic STRIPE_UNAVAILABLE 503. Now the processor catches StripeException and returns a PaymentOperationResult failure with the actual Stripe error message, which the controller surfaces as a 400 BadRequest.

Changes:
[1] Wrapped refundService.CreateAsync in try/catch(StripeException) — returns failure result with ex.StripeError?.Message

References:
[1] [JobFlow.Infrastructure/PaymentGateways/Stripe/StripePaymentProcessor.cs:155](https://github.com/Katharix/JobFlow.API/blob/feature/288-fix-stripe-refund-exception-handling/JobFlow.Infrastructure/PaymentGateways/Stripe/StripePaymentProcessor.cs#L155)
@bllr777 bllr777 merged commit 8b7e6d0 into main May 17, 2026
8 checks passed
@bllr777 bllr777 deleted the feature/288-fix-stripe-refund-exception-handling branch May 17, 2026 02:01
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.

1 participant