Class: KillBillClient::Model::PaymentMethod
- Inherits:
-
PaymentMethodAttributes
- Object
- Resource
- PaymentMethodAttributes
- KillBillClient::Model::PaymentMethod
- Includes:
- AuditLogWithHistoryHelper
- Defined in:
- lib/killbill_client/models/payment_method.rb
Constant Summary collapse
- KILLBILL_API_PAYMENT_METHODS_PREFIX =
"#{KILLBILL_API_PREFIX}/paymentMethods"
- EXTERNAL_PAYMENT =
'__EXTERNAL_PAYMENT__'.freeze
Class Method Summary collapse
- .destroy(payment_method_id, set_auto_pay_off = false, force_default_deletion = false, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
- .find_all_by_account_id(account_id, with_plugin_info = false, options = {}) ⇒ Object
- .find_by_external_key(external_key, included_deleted = false, with_plugin_info = false, audit = 'NONE', options = {}) ⇒ Object
- .find_by_id(payment_method_id, with_plugin_info = false, options = {}) ⇒ Object
- .find_in_batches(offset = 0, limit = 100, options = {}) ⇒ Object
- .find_in_batches_by_search_key(search_key, offset = 0, limit = 100, options = {}) ⇒ Object
- .refresh(account_id, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
- .set_default(payment_method_id, account_id, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
Instance Method Summary collapse
- #create(is_default, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
- #plugin_info=(info) ⇒ Object
Methods included from AuditLogWithHistoryHelper
Class Method Details
.destroy(payment_method_id, set_auto_pay_off = false, force_default_deletion = false, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/killbill_client/models/payment_method.rb', line 71 def destroy(payment_method_id, set_auto_pay_off = false, force_default_deletion = false, user = nil, reason = nil, comment = nil, = {}) delete "#{KILLBILL_API_PAYMENT_METHODS_PREFIX}/#{payment_method_id}", {}, { :forceDefaultPmDeletion => force_default_deletion, :deleteDefaultPmWithAutoPayOff => set_auto_pay_off }, { :user => user, :reason => reason, :comment => comment, }.merge() end |
.find_all_by_account_id(account_id, with_plugin_info = false, options = {}) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/killbill_client/models/payment_method.rb', line 23 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_external_key(external_key, included_deleted = false, with_plugin_info = false, audit = 'NONE', options = {}) ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/killbill_client/models/payment_method.rb', line 49 def find_by_external_key(external_key, included_deleted = false, with_plugin_info = false, audit='NONE', = {}) get "#{KILLBILL_API_PAYMENT_METHODS_PREFIX}", { :externalKey => external_key, :includedDeleted => included_deleted, :audit => audit, :withPluginInfo => with_plugin_info }, end |
.find_by_id(payment_method_id, with_plugin_info = false, options = {}) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/killbill_client/models/payment_method.rb', line 15 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 |
.find_in_batches(offset = 0, limit = 100, options = {}) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/killbill_client/models/payment_method.rb', line 31 def find_in_batches(offset = 0, limit = 100, = {}) get "#{KILLBILL_API_PAYMENT_METHODS_PREFIX}/#{Resource::KILLBILL_API_PAGINATION_PREFIX}", { :offset => offset, :limit => limit }, end |
.find_in_batches_by_search_key(search_key, offset = 0, limit = 100, options = {}) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/killbill_client/models/payment_method.rb', line 40 def find_in_batches_by_search_key(search_key, offset = 0, limit = 100, = {}) get "#{KILLBILL_API_PAYMENT_METHODS_PREFIX}/search/#{search_key}", { :offset => offset, :limit => limit }, end |
.refresh(account_id, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
85 86 87 88 89 90 91 92 93 94 |
# File 'lib/killbill_client/models/payment_method.rb', line 85 def refresh(account_id, user = nil, reason = nil, comment = nil, = {}) put "#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/paymentMethods/refresh", nil, {}, { :user => user, :reason => reason, :comment => comment, }.merge() end |
.set_default(payment_method_id, account_id, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/killbill_client/models/payment_method.rb', line 60 def set_default(payment_method_id, account_id, user = nil, reason = nil, comment = nil, = {}) put "#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/paymentMethods/#{payment_method_id}/setDefault", nil, {}, { :user => user, :reason => reason, :comment => comment, }.merge() end |
Instance Method Details
#create(is_default, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/killbill_client/models/payment_method.rb', line 97 def create(is_default, user = nil, reason = nil, comment = nil, = {}) created_pm = self.class.post "#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/paymentMethods", to_json, { :isDefault => is_default }, { :user => user, :reason => reason, :comment => comment, }.merge() created_pm.refresh() end |
#plugin_info=(info) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/killbill_client/models/payment_method.rb', line 112 def plugin_info=(info) @plugin_info = PaymentMethodPluginDetailAttributes.new @plugin_info.properties = [] return if info.nil? if info['properties'].nil? # Convenience method to create properties to add a payment method info.each do |key, value| property = PluginPropertyAttributes.new property.key = key property.value = value property.is_updatable = false @plugin_info.properties << property end else # De-serialization from JSON payload info['properties'].each do |property_json| property = PluginPropertyAttributes.new property.key = property_json['key'] property.value = property_json['value'] property.is_updatable = property_json['isUpdatable'] @plugin_info.properties << property end end end |