Class: KillBillClient::Model::InvoicePayment
- Inherits:
-
InvoicePaymentAttributes
- Object
- Resource
- InvoicePaymentAttributes
- KillBillClient::Model::InvoicePayment
- Defined in:
- lib/killbill_client/models/invoice_payment.rb
Constant Summary collapse
- KILLBILL_API_INVOICE_PAYMENTS_PREFIX =
"#{KILLBILL_API_PREFIX}/invoicePayments"
Constants inherited from Resource
Resource::KILLBILL_API_PAGINATION_PREFIX, Resource::KILLBILL_API_PREFIX
Instance Attribute Summary
Attributes inherited from Resource
#clazz, #etag, #response, #session_id, #uri
Class Method Summary collapse
- .find_by_id(payment_id, with_plugin_info = false, options = {}) ⇒ Object
- .refund(payment_id, amount, adjustments = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
Instance Method Summary collapse
- #bulk_create(external_payment = false, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
- #create(external_payment = false, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
Methods inherited from Resource
#==, #_to_hash, attribute, create_alias, delete, extract_session_id, from_json, from_response, get, has_many, has_one, #hash, head, #initialize, instantiate_record_from_json, post, put, #refresh, require_multi_tenant_options!, #to_hash, #to_json
Constructor Details
This class inherits a constructor from KillBillClient::Model::Resource
Class Method Details
.find_by_id(payment_id, with_plugin_info = false, options = {}) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/killbill_client/models/invoice_payment.rb', line 10 def find_by_id(payment_id, with_plugin_info = false, = {}) get "#{KILLBILL_API_INVOICE_PAYMENTS_PREFIX}/#{payment_id}", { :withPluginInfo => with_plugin_info }, end |
.refund(payment_id, amount, adjustments = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/killbill_client/models/invoice_payment.rb', line 18 def refund(payment_id, amount, adjustments = nil, user = nil, reason = nil, comment = nil, = {}) payload = InvoicePaymentTransactionAttributes.new payload.amount = amount payload.is_adjusted = !adjustments.nil? payload.adjustments = adjustments invoice_payment = post "#{KILLBILL_API_INVOICE_PAYMENTS_PREFIX}/#{payment_id}/refunds", payload.to_json, {}, { :user => user, :reason => reason, :comment => comment, }.merge() invoice_payment.refresh() end |
Instance Method Details
#bulk_create(external_payment = false, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/killbill_client/models/invoice_payment.rb', line 51 def bulk_create(external_payment = false, user = nil, reason = nil, comment = nil, = {}) # Nothing to return (nil) self.class.post "#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/invoicePayments", {}, { :externalPayment => external_payment, :paymentAmount => purchased_amount }, { :user => user, :reason => reason, :comment => comment, }.merge() end |
#create(external_payment = false, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/killbill_client/models/invoice_payment.rb', line 37 def create(external_payment = false, user = nil, reason = nil, comment = nil, = {}) created_invoice_payment = self.class.post "#{Invoice::KILLBILL_API_INVOICES_PREFIX}/#{target_invoice_id}/payments", to_json, { :externalPayment => external_payment }, { :user => user, :reason => reason, :comment => comment, }.merge() created_invoice_payment.refresh() end |