paiementcic/lib/paiement_cic/form_helper.rb

24 lines
716 B
Ruby
Raw Normal View History

module PaiementCic::FormHelper
def paiement_cic_hidden_fields(reference, price, options = {})
oMac = PaiementCic::TPE.new(options)
oa = oMac.attributes(reference, price, options)
2009-08-17 10:37:35 +02:00
chaineMAC = oMac.compute_hmac_sha1(oa.values.join('*'))
2013-06-05 10:28:56 +02:00
url_retour = options[:url_retour]
url_retour_ok = options[:url_retour_ok]
url_retour_err = options[:url_retour_err]
2013-06-05 10:28:56 +02:00
html = hidden_field_tag('MAC', chaineMAC)
html << hidden_field_tag('url_retour', url_retour)
html << hidden_field_tag('url_retour_ok', url_retour_ok)
html << hidden_field_tag('url_retour_err', url_retour_err)
2012-01-30 09:38:45 +01:00
oa.each do |k,v|
html << hidden_field_tag(k, v) unless v.empty?
end
html
2009-08-17 10:37:35 +02:00
end
end