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"
Class Method Summary collapse
- .find_by_id(payment_id, with_plugin_info = false, with_attempts = 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
Class Method Details
.find_by_id(payment_id, with_plugin_info = false, with_attempts = false, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/killbill_client/models/invoice_payment.rb', line 11 def find_by_id(payment_id, with_plugin_info = false, with_attempts = false, = {}) get "#{KILLBILL_API_INVOICE_PAYMENTS_PREFIX}/#{payment_id}", { :withAttempts => with_attempts, :withPluginInfo => with_plugin_info }, end |
.refund(payment_id, amount, adjustments = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/killbill_client/models/invoice_payment.rb', line 20 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
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/killbill_client/models/invoice_payment.rb', line 53 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
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/killbill_client/models/invoice_payment.rb', line 39 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 |