2011-06-23 15:32:23 +02:00
|
|
|
module PaiementCic::FormHelper
|
2013-06-05 15:22:41 +02:00
|
|
|
def paiement_cic_hidden_fields(reference, price, options = {})
|
|
|
|
oMac = PaiementCic::TPE.new(options)
|
2014-04-09 14:24:13 +02:00
|
|
|
oa = oMac.attributes(reference, price, options)
|
2009-08-17 10:37:35 +02:00
|
|
|
|
2014-04-09 14:24:13 +02:00
|
|
|
chaineMAC = oMac.compute_hmac_sha1(oa.values.join('*'))
|
2013-06-05 10:28:56 +02:00
|
|
|
|
2013-06-05 15:22:41 +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
|
|
|
|
2013-06-05 15:22:41 +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
|
|
|
|
2013-06-05 15:22:41 +02: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
|