Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements Stripe Refund functionality and wires the button #192

Merged
merged 4 commits into from
May 24, 2024

Conversation

beingmattlevy
Copy link
Collaborator

add Refund button to events ticket requests page for all payments page
Uses Stripe Refund API

Integrate Stripe refunds to admin ticket requests view
@beingmattlevy beingmattlevy requested a review from kigster May 24, 2024 18:46
Copy link
Collaborator

@kigster kigster left a comment

Choose a reason for hiding this comment

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

Left some suggestions there, but I would also really love to see a spec for the tickets_request_controller that invokes refund action and mocks the Stripe API, and verifies that the ticket_request has been refunded. We can pair on this if you like.

self.status = STATUS_REFUNDED
Rails.logger.info { "refund_payment success stripe_refund_id [#{stripe_refund_id}] status [#{status}]" }
log_refund(refund)
save
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might want to call save! which raises exception if it can't be saved.

Then you could add additional rescue:

   rescue StandardError => e
     Rails.logger.error("#{e.class.name} ERROR during a refund: #{e.message.colorize(:red)}")

app/models/ticket_request.rb Show resolved Hide resolved
Rails.logger.info { "ticket_request [#{id}] payment [#{payment.id}] refunding [#{payment.stripe_payment_id}]" }
if payment.refund_payment
mark_refunded
true
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove the true — we should return the result of mark_refunded which would be true if the update succeeds. See above.

mark_refunded
true
else
Rails.logger.error { "ticket_request failed to refund [#{payment.stripe_payment_id}]" }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add the cause to the logger, by adding errors&.error_messages&.join('; ').

@kigster kigster changed the title mfl/stripe refunds Implements Stripe Refund functionality and wires the button May 24, 2024
@kigster kigster added review-requires-updates Updates were requested by a reviewer and removed work-in-progress labels May 24, 2024
@beingmattlevy beingmattlevy merged commit 6ba41b6 into main May 24, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review-requires-updates Updates were requested by a reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants