Class: FatZebra::Models::Refund
- Defined in:
- lib/fat_zebra/models/refund.rb
Class Method Summary collapse
-
.create(transaction_id, amount, reference) ⇒ 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) ⇒ Refund
Refunds a transaction
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fat_zebra/models/refund.rb', line 29 def create(transaction_id, amount, reference) params = { :transaction_id => transaction_id, :amount => amount, :reference => reference } 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
9 10 11 |
# File 'lib/fat_zebra/models/refund.rb', line 9 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
16 17 18 |
# File 'lib/fat_zebra/models/refund.rb', line 16 def successful self.refunded == "Approved" end |