Skip to content

Commit

Permalink
Merge pull request #5 from adammathys/refund
Browse files Browse the repository at this point in the history
Add support for refunding payments
  • Loading branch information
stewart authored Sep 2, 2016
2 parents fa9313b + 476cb08 commit fa7f4f7
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 fa7f4f7

Please sign in to comment.