Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Solidus passes a Spree::Payment object not the payment response code #154

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/models/solidus_paypal_braintree/gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ def cancel(response_code)
# @param response_code [String] the transaction id of the payment to void
# @return [Response|FalseClass]
def try_void(response_code)
# If response_code is an instance of Spree::Payment
response_code = response_code.response_code if response_code.respond_to?(:response_code)

transaction = braintree.transaction.find(response_code)
if transaction.status.in? SolidusPaypalBraintree::Gateway::VOIDABLE_STATUSES
# Sometimes Braintree returns a voidable status although it is not voidable anymore.
Expand Down