-
Notifications
You must be signed in to change notification settings - Fork 3
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
Conversation
Integrate Stripe refunds to admin ticket requests view
There was a problem hiding this 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.
app/models/payment.rb
Outdated
self.status = STATUS_REFUNDED | ||
Rails.logger.info { "refund_payment success stripe_refund_id [#{stripe_refund_id}] status [#{status}]" } | ||
log_refund(refund) | ||
save |
There was a problem hiding this comment.
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
Outdated
Rails.logger.info { "ticket_request [#{id}] payment [#{payment.id}] refunding [#{payment.stripe_payment_id}]" } | ||
if payment.refund_payment | ||
mark_refunded | ||
true |
There was a problem hiding this comment.
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.
app/models/ticket_request.rb
Outdated
mark_refunded | ||
true | ||
else | ||
Rails.logger.error { "ticket_request failed to refund [#{payment.stripe_payment_id}]" } |
There was a problem hiding this comment.
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('; ')
.
add Refund button to events ticket requests page for all payments page
Uses Stripe Refund API