Skip to content

Commit

Permalink
Add support for refunding payments
Browse files Browse the repository at this point in the history
  • Loading branch information
adammathys committed Sep 2, 2016
1 parent fa9313b commit 476cb08
Show file tree
Hide file tree
Showing 8 changed files with 608 additions and 274 deletions.
10 changes: 8 additions & 2 deletions app/models/solidus_paypal_braintree/gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,15 @@ def capture(_money, _source, _gateway_options)
raise NotImplementedError
end

# Used to refeund a customer for an already settled transaction.
#
# @api public
# @param money [#to_s] amount to refund
# @param response_code [String] the transaction is of the payment to refund
# @return [Response]
def credit(_money, _source, _response_code, _gateway_options)
raise NotImplementedError
def credit(money, _source, response_code, _gateway_options)
result = Braintree::Transaction.refund(response_code, money)
Response.build(result)
end

# Used to cancel a transaction before it is settled.
Expand Down
78 changes: 39 additions & 39 deletions spec/fixtures/cassettes/braintree/authorize.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 476cb08

Please sign in to comment.