Class: KillBillClient::Model::InvoicePayment
Constant Summary
collapse
- KILLBILL_API_INVOICE_PAYMENTS_PREFIX =
"#{KILLBILL_API_PREFIX}/invoicePayments"
Constants included
from TagHelper
TagHelper::AUTO_INVOICING_OFF_ID, TagHelper::AUTO_PAY_OFF_ID, TagHelper::MANUAL_PAY_ID, TagHelper::OVERDUE_ENFORCEMENT_OFF_ID, TagHelper::TEST_ID, TagHelper::WRITTEN_OFF_ID
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
-
.chargeback(payment_id, amount, currency, effective_date = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
.chargeback_reversal(payment_id, transaction_external_key, effective_date = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
.complete_invoice_payment_transaction(payment_id, user, reason, comment, options) ⇒ Object
-
.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, payment_method_id = nil, target_date = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#create(external_payment = false, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
Methods included from TagHelper
#add_tag, #add_tag_from_definition_id, #control_tag?, included, #remove_tag, #remove_tag_from_definition_id, #set_tags
included
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
Class Method Details
.chargeback(payment_id, amount, currency, effective_date = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/killbill_client/models/invoice_payment.rb', line 45
def chargeback(payment_id, amount, currency, effective_date = nil, user = nil, reason = nil, = nil, options = {})
payload = InvoicePaymentTransactionAttributes.new
payload.amount = amount
payload.currency = currency
payload.effective_date = effective_date
invoice_payment = post "#{KILLBILL_API_INVOICE_PAYMENTS_PREFIX}/#{payment_id}/chargebacks",
payload.to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
invoice_payment.refresh(options)
end
|
.chargeback_reversal(payment_id, transaction_external_key, effective_date = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/killbill_client/models/invoice_payment.rb', line 62
def chargeback_reversal(payment_id, transaction_external_key, effective_date = nil, user = nil, reason = nil, = nil, options = {})
payload = InvoicePaymentTransactionAttributes.new
payload.transaction_external_key = transaction_external_key
payload.effective_date = effective_date
invoice_payment = post "#{KILLBILL_API_INVOICE_PAYMENTS_PREFIX}/#{payment_id}/chargebackReversals",
payload.to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
invoice_payment.refresh(options)
end
|
.complete_invoice_payment_transaction(payment_id, user, reason, comment, options) ⇒ Object
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/killbill_client/models/invoice_payment.rb', line 78
def complete_invoice_payment_transaction(payment_id, user, reason, , options)
invoice_payment = PaymentTransactionAttributes.new
invoice_payment.payment_id = payment_id
put "#{KILLBILL_API_INVOICE_PAYMENTS_PREFIX}/#{payment_id}",
invoice_payment.to_json,
{},
{
:user => user,
:reason => reason,
:comment =>
}.merge(options)
end
|
.find_by_id(payment_id, with_plugin_info = false, with_attempts = false, options = {}) ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/killbill_client/models/invoice_payment.rb', line 18
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/killbill_client/models/invoice_payment.rb', line 27
def refund(payment_id, amount, adjustments = nil, user = nil, reason = nil, = 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 => ,
}.merge(options)
invoice_payment.refresh(options)
end
|
Instance Method Details
#bulk_create(external_payment = false, payment_method_id = nil, target_date = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# File 'lib/killbill_client/models/invoice_payment.rb', line 107
def bulk_create(external_payment = false, payment_method_id = nil, target_date = nil, user = nil, reason = nil, = nil, options = {})
self.class.post "#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/invoicePayments",
{},
{
:externalPayment => external_payment,
:paymentAmount => purchased_amount,
:paymentMethodId => payment_method_id,
:targetDate => target_date
},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
end
|
#create(external_payment = false, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
93
94
95
96
97
98
99
100
101
102
103
104
105
|
# File 'lib/killbill_client/models/invoice_payment.rb', line 93
def create(external_payment = false, user = nil, reason = nil, = 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 => ,
}.merge(options)
created_invoice_payment.refresh(options)
end
|