Class: FatZebra::Models::Refund
- Defined in:
- lib/fat_zebra/models/refund.rb
Class Method Summary collapse
-
.create(transaction_id, amount, reference, optional = {}) ⇒ Refund
Refunds a transaction.
Instance Method Summary collapse
-
#original_transaction ⇒ Object
Returns the original transaction for this refund.
-
#successful ⇒ Object
(also: #successful?)
Indicates if the refund was successful or not.
Methods inherited from Base
attribute, #initialize, #inspect, #to_s
Constructor Details
This class inherits a constructor from FatZebra::Models::Base
Class Method Details
.create(transaction_id, amount, reference, optional = {}) ⇒ Refund
Refunds a transaction
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fat_zebra/models/refund.rb', line 31 def create(transaction_id, amount, reference, optional = {}) params = { :transaction_id => transaction_id, :amount => amount, :reference => reference } params.merge!(optional) response = FatZebra.gateway.make_request(:post, "refunds", params) Response.new(response, :refund) end |
Instance Method Details
#original_transaction ⇒ Object
Returns the original transaction for this refund
10 11 12 |
# File 'lib/fat_zebra/models/refund.rb', line 10 def original_transaction @original_transaction ||= Purchase.find(self.original_transaction_id) end |
#successful ⇒ Object Also known as: successful?
Indicates if the refund was successful or not
17 18 19 |
# File 'lib/fat_zebra/models/refund.rb', line 17 def successful self.refunded == "Approved" end |