Class: Kaui::Admin
- Inherits:
-
KillBillClient::Model::Resource
- Object
- KillBillClient::Model::Resource
- Kaui::Admin
- Defined in:
- app/models/kaui/admin.rb
Constant Summary collapse
- KILLBILL_API_ADMIN_PREFIX =
"#{KILLBILL_API_PREFIX}/admin".freeze
- KILLBILL_API_QUEUES_PREFIX =
"#{KILLBILL_API_ADMIN_PREFIX}/queues".freeze
- KILLBILL_API_CLOCK_PREFIX =
"#{KILLBILL_API_PREFIX}/test/clock".freeze
Class Method Summary collapse
- .fix_transaction_state(payment_id, transaction_id, transaction_status, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
- .get_clock(time_zone, options) ⇒ Object
- .get_queues_entries(account_id, options = {}) ⇒ Object
- .increment_kb_clock(days, weeks, months, years, time_zone, options) ⇒ Object
- .set_clock(requested_date, time_zone, options) ⇒ Object
Class Method Details
.fix_transaction_state(payment_id, transaction_id, transaction_status, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'app/models/kaui/admin.rb', line 25 def fix_transaction_state(payment_id, transaction_id, transaction_status, user = nil, reason = nil, comment = nil, = {}) KillBillClient::API.put "#{KILLBILL_API_ADMIN_PREFIX}/payments/#{payment_id}/transactions/#{transaction_id}", { transactionStatus: transaction_status }.to_json, {}, { user: user, reason: reason, comment: comment }.merge() end |
.get_clock(time_zone, options) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'app/models/kaui/admin.rb', line 36 def get_clock(time_zone, ) params = {} params[:timeZone] = time_zone unless time_zone.nil? res = KillBillClient::API.get KILLBILL_API_CLOCK_PREFIX, params, JSON.parse res.body end |
.get_queues_entries(account_id, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/models/kaui/admin.rb', line 11 def get_queues_entries(account_id, = {}) res = KillBillClient::API.get KILLBILL_API_QUEUES_PREFIX, { accountId: account_id, withHistory: [:withHistory], minDate: [:minDate], maxDate: [:maxDate] }, { accept: 'application/octet-stream' }.merge() JSON.parse res.body end |
.increment_kb_clock(days, weeks, months, years, time_zone, options) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'app/models/kaui/admin.rb', line 61 def increment_kb_clock(days, weeks, months, years, time_zone, ) params = {} params[:days] = days unless days.nil? params[:weeks] = weeks unless weeks.nil? params[:months] = months unless months.nil? params[:years] = years unless years.nil? params[:timeZone] = time_zone unless time_zone.nil? # The default 5s is not always enough params[:timeoutSec] ||= 10 res = KillBillClient::API.put KILLBILL_API_CLOCK_PREFIX, {}, params, {}.merge() JSON.parse res.body end |
.set_clock(requested_date, time_zone, options) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/models/kaui/admin.rb', line 46 def set_clock(requested_date, time_zone, ) params = {} params[:requestedDate] = requested_date unless requested_date.nil? params[:timeZone] = time_zone unless time_zone.nil? # The default 5s is not always enough params[:timeoutSec] ||= 10 res = KillBillClient::API.post KILLBILL_API_CLOCK_PREFIX, {}, params, {}.merge() JSON.parse res.body end |