Class: Killbill::Deposit::DepositClient
- Inherits:
-
KillBillClient::Model::Resource
- Object
- KillBillClient::Model::Resource
- Killbill::Deposit::DepositClient
- Defined in:
- lib/deposit/client.rb
Constant Summary collapse
- KILLBILL_DEPOSIT_PREFIX =
'/plugins/killbill-deposit'
Class Method Summary collapse
- .deposit_plugin_available?(options = nil) ⇒ Boolean
- .record_payments(account_id, effective_date, payment_reference_number, deposit_type, invoice_payments, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
Class Method Details
.deposit_plugin_available?(options = nil) ⇒ Boolean
35 36 37 38 39 40 41 42 43 |
# File 'lib/deposit/client.rb', line 35 def deposit_plugin_available?( = nil) path = "#{KILLBILL_DEPOSIT_PREFIX}/healthcheck" KillBillClient::API.get path, nil, [true, nil] # Response error if the deposit plugin is not listening rescue KillBillClient::API::ResponseError => e [false, e..to_s] end |
.record_payments(account_id, effective_date, payment_reference_number, deposit_type, invoice_payments, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/deposit/client.rb', line 9 def record_payments(account_id, effective_date, payment_reference_number, deposit_type, invoice_payments, user = nil, reason = nil, comment = nil, = {}) payments = [] invoice_payments.each do |invoice_number, payment_amount| payments << { invoiceNumber: invoice_number, paymentAmount: payment_amount } end body = { accountId: account_id, effectiveDate: effective_date, paymentReferenceNumber: payment_reference_number, depositType: deposit_type, payments: payments }.to_json path = "#{KILLBILL_DEPOSIT_PREFIX}/record" response = KillBillClient::API.post path, body, {}, { user: user, reason: reason, comment: comment }.merge() response.body end |