Class: KillBillClient::Model::Refund

Inherits:
RefundAttributes show all
Defined in:
lib/killbill_client/models/refund.rb

Constant Summary collapse

KILLBILL_API_REFUNDS_PREFIX =
"#{KILLBILL_API_PREFIX}/refunds"

Constants inherited from Resource

KillBillClient::Model::Resource::KILLBILL_API_PAGINATION_PREFIX, KillBillClient::Model::Resource::KILLBILL_API_PREFIX

Instance Attribute Summary

Attributes inherited from Resource

#clazz, #etag, #response, #session_id, #uri

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#==, #_to_hash, attribute, create_alias, delete, extract_session_id, from_json, from_response, get, has_many, has_one, #hash, head, instantiate_record_from_json, post, put, #refresh, #to_hash, #to_json

Class Method Details

.find_all_by_payment_id(payment_id, options = {}) ⇒ Object



16
17
18
19
20
# File 'lib/killbill_client/models/refund.rb', line 16

def find_all_by_payment_id payment_id, options = {}
  get "#{Payment::KILLBILL_API_PAYMENTS_PREFIX}/#{payment_id}/refunds",
  {},
  options
end

.find_by_id(refund_id, options = {}) ⇒ Object



10
11
12
13
14
# File 'lib/killbill_client/models/refund.rb', line 10

def find_by_id refund_id, options = {}
  get "#{KILLBILL_API_REFUNDS_PREFIX}/#{refund_id}",
  {},
  options
end

Instance Method Details

#create(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object

end class methods



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/killbill_client/models/refund.rb', line 24

def create(user = nil, reason = nil, comment = nil, options = {})
  created_refund = self.class.post "#{Payment::KILLBILL_API_PAYMENTS_PREFIX}/#{@payment_id}/refunds",
                                   to_json,
                                   {},
                                   {
                                     :user => user,
                                     :reason => reason,
                                     :comment => comment,
                                   }.merge(options)

  created_refund.refresh(options)
end