Class: Lago::Api::Resources::WalletTransaction
- Inherits:
-
Base
- Object
- Base
- Lago::Api::Resources::WalletTransaction
show all
- Defined in:
- lib/lago/api/resources/wallet_transaction.rb
Instance Attribute Summary
Attributes inherited from Base
#client
Instance Method Summary
collapse
Methods inherited from Base
#create, #destroy, #get, #initialize, #update
Instance Method Details
#api_resource ⇒ Object
9
10
11
|
# File 'lib/lago/api/resources/wallet_transaction.rb', line 9
def api_resource
'wallet_transactions'
end
|
#consumptions(wallet_transaction_id, options = {}) ⇒ Object
31
32
33
34
35
36
|
# File 'lib/lago/api/resources/wallet_transaction.rb', line 31
def consumptions(wallet_transaction_id, options = {})
path = "/api/v1/wallet_transactions/#{wallet_transaction_id}/consumptions"
response = connection.get_all(options, path)
JSON.parse(response.to_json, object_class: OpenStruct)
end
|
#fundings(wallet_transaction_id, options = {}) ⇒ Object
38
39
40
41
42
43
|
# File 'lib/lago/api/resources/wallet_transaction.rb', line 38
def fundings(wallet_transaction_id, options = {})
path = "/api/v1/wallet_transactions/#{wallet_transaction_id}/fundings"
response = connection.get_all(options, path)
JSON.parse(response.to_json, object_class: OpenStruct)
end
|
#get_all(wallet_id, options = {}) ⇒ Object
17
18
19
20
21
22
|
# File 'lib/lago/api/resources/wallet_transaction.rb', line 17
def get_all(wallet_id, options = {})
path = "/api/v1/wallets/#{wallet_id}/wallet_transactions"
response = connection.get_all(options, path)
JSON.parse(response.to_json, object_class: OpenStruct)
end
|
#payment_url(wallet_transaction_id) ⇒ Object
24
25
26
27
28
29
|
# File 'lib/lago/api/resources/wallet_transaction.rb', line 24
def payment_url(wallet_transaction_id)
path = "/api/v1/wallet_transactions/#{wallet_transaction_id}/payment_url"
response = connection.post({}, path)['wallet_transaction_payment_details']
JSON.parse(response.to_json, object_class: OpenStruct)
end
|
#root_name ⇒ Object
13
14
15
|
# File 'lib/lago/api/resources/wallet_transaction.rb', line 13
def root_name
'wallet_transactions'
end
|
#whitelist_params(params) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/lago/api/resources/wallet_transaction.rb', line 45
def whitelist_params(params)
result = params.compact.slice(
:wallet_id,
:name,
:paid_credits,
:granted_credits,
:voided_credits,
:invoice_requires_successful_payment,
:ignore_paid_top_up_limits,
:metadata,
)
payment_method_params = whitelist_payment_method_params(params[:payment_method])
result[:payment_method] = payment_method_params if payment_method_params
invoice_custom_section = whitelist_invoice_custom_section_params(params[:invoice_custom_section])
result[:invoice_custom_section] = invoice_custom_section if invoice_custom_section
{ 'wallet_transaction' => result }
end
|