Class: Chargify::Transaction

Inherits:
Base
  • Object
show all
Defined in:
lib/chargify_api_ares/resources/transaction.rb

Instance Method Summary collapse

Methods inherited from Base

element_name, #to_xml

Instance Method Details

#full_refund(attrs = {}) ⇒ Object



3
4
5
6
7
8
# File 'lib/chargify_api_ares/resources/transaction.rb', line 3

def full_refund(attrs = {})
  return false if self.transaction_type != 'payment'

  attrs.merge!(:amount_in_cents => self.amount_in_cents)
  self.refund(attrs)
end

#refund(attrs = {}) ⇒ Object



10
11
12
13
14
15
# File 'lib/chargify_api_ares/resources/transaction.rb', line 10

def refund(attrs = {})
  return false if self.transaction_type != 'payment'

  attrs.merge!(:payment_id => self.id)
  Subscription.find(self.subscription_id).refund(attrs)
end