Class: KillBillClient::Model::PaymentMethod
Constant Summary
collapse
- KILLBILL_API_PAYMENT_METHODS_PREFIX =
"#{KILLBILL_API_PREFIX}/paymentMethods"
Constants inherited
from Resource
Resource::KILLBILL_API_PREFIX
Instance Attribute Summary
Attributes inherited from Resource
#uri
Class Method Summary
collapse
-
.destroy(payment_method_id, set_auto_pay_off = false, user = nil, reason = nil, comment = nil) ⇒ Object
-
.find_all_by_account_id(account_id, with_plugin_info = false) ⇒ Object
-
.find_by_id(payment_method_id, with_plugin_info = false) ⇒ Object
-
.set_default(payment_method_id, account_id, user = nil, reason = nil, comment = nil) ⇒ Object
Instance Method Summary
collapse
Methods inherited from Resource
attribute, delete, from_json, from_response, get, head, instantiate_record_from_json, post, put, #refresh, #to_hash, #to_json
Class Method Details
.destroy(payment_method_id, set_auto_pay_off = false, user = nil, reason = nil, comment = nil) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/killbill_client/models/payment_method.rb', line 32
def destroy(payment_method_id, set_auto_pay_off = false, user = nil, reason = nil, = nil)
delete "#{KILLBILL_API_PAYMENT_METHODS_PREFIX}/#{payment_method_id}",
{
:deleteDefaultPmWithAutoPayOff => set_auto_pay_off
},
{
:user => user,
:reason => reason,
:comment => ,
}
end
|
.find_all_by_account_id(account_id, with_plugin_info = false) ⇒ Object
14
15
16
17
18
19
|
# File 'lib/killbill_client/models/payment_method.rb', line 14
def find_all_by_account_id(account_id, with_plugin_info = false)
get "#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/paymentMethods",
{
:withPluginInfo => with_plugin_info
}
end
|
.find_by_id(payment_method_id, with_plugin_info = false) ⇒ Object
7
8
9
10
11
12
|
# File 'lib/killbill_client/models/payment_method.rb', line 7
def find_by_id(payment_method_id, with_plugin_info = false)
get "#{KILLBILL_API_PAYMENT_METHODS_PREFIX}/#{payment_method_id}",
{
:withPluginInfo => with_plugin_info
}
end
|
.set_default(payment_method_id, account_id, user = nil, reason = nil, comment = nil) ⇒ Object
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/killbill_client/models/payment_method.rb', line 21
def set_default(payment_method_id, account_id, user = nil, reason = nil, = nil)
put "#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/paymentMethods/#{payment_method_id}/setDefault",
nil,
{},
{
:user => user,
:reason => reason,
:comment => ,
}
end
|
Instance Method Details
#create(set_default = true, user = nil, reason = nil, comment = nil) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/killbill_client/models/payment_method.rb', line 45
def create(set_default = true, user = nil, reason = nil, = nil)
created_pm = self.class.post "#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/paymentMethods",
to_json,
{
:isDefault => set_default
},
{
:user => user,
:reason => reason,
:comment => ,
}
created_pm.refresh
end
|
#destroy(set_auto_pay_off = false, user = nil, reason = nil, comment = nil) ⇒ Object
59
60
61
|
# File 'lib/killbill_client/models/payment_method.rb', line 59
def destroy(set_auto_pay_off = false, user = nil, reason = nil, = nil)
self.class.destroy(payment_method_id, set_auto_pay_off, user, reason, )
end
|
#plugin_info=(info) ⇒ Object
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/killbill_client/models/payment_method.rb', line 63
def plugin_info=(info)
@plugin_info = PaymentMethodPluginDetailAttributes.new
@plugin_info.properties = []
return if info.nil?
info.each { |k, v| @plugin_info.send("#{Utils.underscore k}=", v) unless k == 'properties' }
if info['properties'].nil?
info.each do |key, value|
property = PaymentMethodProperties.new
property.key = key
property.value = value
property.is_updatable = false
@plugin_info.properties << property
end
else
info['properties'].each do |property_json|
property = PaymentMethodProperties.new
property.key = property_json['key']
property.value = property_json['value']
property.is_updatable = property_json['isUpdatable']
@plugin_info.properties << property
end
end
end
|