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_PREFIX

Instance Attribute Summary

Attributes inherited from Resource

#etag, #response, #session_id, #uri

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

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

Class Method Details

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



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

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



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

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



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

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