module CreditCardTypeField
module ViewHelper
module FormHelper
def credit_card_type_field(method, options = {})
options[:card_number_field_name] ||= 'credit_card_no'
field_name = "#{@object_name}\\\\[#{options[:card_number_field_name]}\\\\]"
options[:accept_types] ||= %w(visa master american_express diners_club)
html = '
'.html_safe
options[:accept_types].each {|type| html << "- #{type.camelize}
".html_safe }
html << %Q(- Invalid Card
- Not a Valid Credit Card Number
).html_safe
html << hidden_field(method, rel: 'credit-card-type')
html << %Q(
).html_safe
end
end
module FormTagHelper
def credit_card_type_field_tag(name, value = nil, options = {})
options[:card_number_field_name] ||= 'credit_card_no'
field_name = options[:card_number_field_name]
options[:accept_types] ||= %w(visa master american_express diners_club)
html = ''.html_safe
options[:accept_types].each {|type| html << "- #{type.camelize}
".html_safe }
html << %Q(- Invalid Card
- Not a Valid Credit Card Number
).html_safe
html << hidden_field_tag(name, value, rel: 'credit-card-type')
html << %Q(
).html_safe
end
end
end
end