Class: Flow::Reference::PaymentMethods

Inherits:
Object
  • Object
show all
Defined in:
lib/flow-reference.rb,
lib/generated/payment_methods.rb

Defined Under Namespace

Classes: Data

Constant Summary collapse

SUPPORTED_CREDIT_CARDS =
[:alipay, :american_express, :bitcoin, :cartes_bancaires, :china_union_pay, :dankort, :diners_club, :directEbanking, :discover, :giropay, :ideal, :jcb, :klarna, :maestro, :mastercard, :paypal, :qiwiwallet, :sepadirectdebit, :unionpay, :visa, :wechatpay]

Class Method Summary collapse

Class Method Details

.find(payment_code) ⇒ Object



88
89
90
91
92
# File 'lib/flow-reference.rb', line 88

def find(payment_code)
  code = payment_code.gsub(/[^\w]/,'').capitalize.gsub(/_(\w)/){ $1.upcase }
  return nil unless Data.respond_to?(code)
  Data.send(code)
end

.find!(payment_code) ⇒ Object



94
95
96
# File 'lib/flow-reference.rb', line 94

def find!(payment_code)
   find(payment_code) || raise(ArgumentError, 'Payment method "%s" is not found' % payment_code)
end