Class: Balanced::Debit
- Inherits:
-
Object
- Object
- Balanced::Debit
- Includes:
- HypermediaRegistry, Resource
- Defined in:
- lib/balanced/resources/debit.rb
Overview
A Debit represents a transfer of funds from a buyer’s Account to your Marketplace’s escrow account.
A Debit may be created directly, or it will be created as a side-effect of capturing a Hold. If you create a Debit directly it will implicitly create the associated Hold if the funding source supports this.
If no Hold is specified the Debit will by default be created using the most recently added funding source associated with the Account. You cannot change the funding source between creating a Hold and capturing it.
Instance Attribute Summary
Attributes included from Resource
#attributes, #href, #hyperlinks, #id, #links
Instance Method Summary collapse
-
#refund(options = {}) ⇒ Refund
Refunds this Debit.
Methods included from HypermediaRegistry
Methods included from Resource
#copy_from, #does_resource_respond_to?, #fetch, #hydrate, included, #initialize, #method_missing, #reload, #respond_to?, #respond_to_missing?, #sanitize, #save, #unstore
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Balanced::Resource
Instance Method Details
#refund(options = {}) ⇒ Refund
Refunds this Debit. If no amount is specified it will refund the entire amount of the Debit, you may create many Refunds up to the sum total of the original Debit’s amount.
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/balanced/resources/debit.rb', line 25 def refund(={}) amount = [:amount] description = [:description] refund = Refund.new( :href => self.refunds.href, :amount => amount, :description => description ) refund.save end |