Class: KillBillClient::Model::InvoicePayment

Inherits:
InvoicePaymentAttributes show all
Includes:
CustomFieldHelper
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

Instance Method Summary collapse

Methods included from CustomFieldHelper

included

Class Method Details

.find_by_id(payment_id, with_plugin_info = false, with_attempts = false, options = {}) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/killbill_client/models/invoice_payment.rb', line 16

def find_by_id(payment_id, with_plugin_info = false, with_attempts = false, options = {})
  get "#{KILLBILL_API_INVOICE_PAYMENTS_PREFIX}/#{payment_id}",
      {
          :withAttempts => with_attempts,
          :withPluginInfo => with_plugin_info
      },
      options
end

.refund(payment_id, amount, adjustments = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/killbill_client/models/invoice_payment.rb', line 25

def refund(payment_id, amount, adjustments = nil, user = nil, reason = nil, comment = nil, options = {})
  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(options)

  invoice_payment.refresh(options)
end

Instance Method Details

#bulk_create(external_payment = false, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/killbill_client/models/invoice_payment.rb', line 58

def bulk_create(external_payment = false, user = nil, reason = nil, comment = nil, options = {})
  # Nothing to return (nil)
  self.class.post "#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{}/invoicePayments",
                  {},
                  {
                      :externalPayment => external_payment,
                      :paymentAmount   => purchased_amount
                  },
                  {
                      :user    => user,
                      :reason  => reason,
                      :comment => comment,
                  }.merge(options)
end

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



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/killbill_client/models/invoice_payment.rb', line 44

def create(external_payment = false, user = nil, reason = nil, comment = nil, options = {})
  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(options)
  created_invoice_payment.refresh(options)
end