2009-12-21 11:24:45 +01:00
|
|
|
## refactor this
|
2011-06-23 15:32:23 +02:00
|
|
|
module PaiementCic::FormHelper
|
2009-12-21 11:24:45 +01:00
|
|
|
def paiement_cic_hidden_fields(order, price, order_transaction, options = {})
|
|
|
|
oa = PaiementCic.config(price, order_transaction.reference)
|
2009-08-17 10:37:35 +02:00
|
|
|
|
2009-12-21 11:24:45 +01:00
|
|
|
oMac = PaiementCic.new
|
|
|
|
sDate = Time.now.strftime("%d/%m/%Y:%H:%M:%S")
|
|
|
|
chaine = [oMac.tpe, sDate, oa["montant"], oa["reference"].to_s, oa["texte-libre"], oMac.version, "FR", oMac.societe, "", "", "", "", "", "", "", "", "", "", ""].join("*")
|
|
|
|
chaineMAC = oMac.computeHMACSHA1(chaine)
|
|
|
|
|
2012-01-30 11:26:07 +01:00
|
|
|
url_retour = options[:url_retour] || bank_callback_order_transactions_url
|
|
|
|
url_retour_ok = options[:url_retour_ok] || bank_callback_order_transactions_url(order)
|
|
|
|
url_retour_err = options[:url_retour_err] || bank_err_order_transaction_url(order)
|
|
|
|
|
2009-12-21 11:24:45 +01:00
|
|
|
html = '
|
|
|
|
<input type="hidden" name="version" id="version" value="' + oa["version"] + '" />
|
|
|
|
<input type="hidden" name="TPE" id="TPE" value="' + oa["TPE"] + '" />
|
|
|
|
<input type="hidden" name="date" id="date" value="' + oa["date"] + '" />
|
|
|
|
<input type="hidden" name="montant" id="montant" value="' + oa["montant"] + '" />
|
|
|
|
<input type="hidden" name="reference" id="reference" value="' + oa["reference"].to_s + '" />
|
|
|
|
<input type="hidden" name="MAC" id="MAC" value="' + chaineMAC + '" />
|
2012-01-30 11:26:07 +01:00
|
|
|
<input type="hidden" name="url_retour" id="url_retour" value="' + url_retour + '" />
|
|
|
|
<input type="hidden" name="url_retour_ok" id="url_retour_ok" value="' + url_retour_ok + '" />
|
|
|
|
<input type="hidden" name="url_retour_err" id="url_retour_err" value="' + url_retour_err + '" />
|
2009-12-21 11:24:45 +01:00
|
|
|
<input type="hidden" name="lgue" id="lgue" value="' + oa["lgue"] + '" />
|
|
|
|
<input type="hidden" name="societe" id="societe" value="' + oa["societe"] + '" />
|
|
|
|
<input type="hidden" name="texte-libre" id="texte-libre" value="' + oa["texte-libre"] + '" />
|
|
|
|
<input type="hidden" name="mail" id="mail" value="''" />'
|
2012-01-30 09:38:45 +01:00
|
|
|
|
|
|
|
html.respond_to?(:html_safe) ? html.html_safe : html
|
2009-08-17 10:37:35 +02:00
|
|
|
end
|
|
|
|
end
|