Class: AdvancedBilling::CreatePrepaymentMethod
- Inherits:
-
Object
- Object
- AdvancedBilling::CreatePrepaymentMethod
- Defined in:
- lib/advanced_billing/models/create_prepayment_method.rb
Overview
:- When the ‘method` specified is `“credit_card_on_file”`, the prepayment amount will be collected using the default credit card payment profile and applied to the prepayment account balance. This is especially useful for manual replenishment of prepaid subscriptions.
Constant Summary collapse
- CREATE_PREPAYMENT_METHOD =
[ # TODO: Write general description for CHECK CHECK = 'check'.freeze, # TODO: Write general description for CASH CASH = 'cash'.freeze, # TODO: Write general description for MONEY_ORDER MONEY_ORDER = 'money_order'.freeze, # TODO: Write general description for ACH ACH = 'ach'.freeze, # TODO: Write general description for PAYPAL_ACCOUNT PAYPAL_ACCOUNT = 'paypal_account'.freeze, # TODO: Write general description for CREDIT_CARD CREDIT_CARD = 'credit_card'.freeze, # TODO: Write general description for CREDIT_CARD_ON_FILE CREDIT_CARD_ON_FILE = 'credit_card_on_file'.freeze, # TODO: Write general description for OTHER OTHER = 'other'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = CHECK) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/advanced_billing/models/create_prepayment_method.rb', line 44 def self.from_value(value, default_value = CHECK) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'check' then CHECK when 'cash' then CASH when 'money_order' then MONEY_ORDER when 'ach' then ACH when 'paypal_account' then PAYPAL_ACCOUNT when 'credit_card' then CREDIT_CARD when 'credit_card_on_file' then CREDIT_CARD_ON_FILE when 'other' then OTHER else default_value end end |
.validate(value) ⇒ Object
38 39 40 41 42 |
# File 'lib/advanced_billing/models/create_prepayment_method.rb', line 38 def self.validate(value) return false if value.nil? CREATE_PREPAYMENT_METHOD.include?(value) end |