From 8cb1aff141ba4979bc2fba0b74d07dad24c6aebd Mon Sep 17 00:00:00 2001 From: David Bourguignon Date: Mon, 17 Aug 2009 10:48:58 +0200 Subject: [PATCH] in paiement_cic_hidden_fields, use a hash to obtain the urls --- README.markdown | 2 +- lib/paiement_cic_helper.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.markdown b/README.markdown index 42803a2..6b2c667 100644 --- a/README.markdown +++ b/README.markdown @@ -37,7 +37,7 @@ script/plugin install git://github.com/novelys/paiementcic.git ### in the payment by card view : - form_tag PaiementCic.target_url do - = paiement_cic_hidden_fields(@order, @order_transaction) + = paiement_cic_hidden_fields(@order, @order_transaction, :url_retour => edit_order_url(order), :url_retour_ok => bank_ok_order_transaction_url(order_transaction), :url_retour_err => bank_err_order_transaction_url(order_transaction)) = submit_tag "Accéder au site de la banque", :style => "font-weight: bold;" = image_tag "reassuring_pictograms.jpg", :alt => "Pictogrammes rassurants", :style => "width: 157px;" diff --git a/lib/paiement_cic_helper.rb b/lib/paiement_cic_helper.rb index 31d140f..9563654 100644 --- a/lib/paiement_cic_helper.rb +++ b/lib/paiement_cic_helper.rb @@ -1,11 +1,11 @@ module PaiementCicHelper - def paiement_cic_hidden_fields(order, order_transaction) + def paiement_cic_hidden_fields(order, order_transaction, options = {}) oa = PaiementCic.config(order.amount, order_transaction.reference) hsh = oa.dup - hsh["url_retour"] = edit_account_order_url(order) - hsh["url_retour_ok"] = bank_ok_order_transaction_url(order_transaction) - hsh["url_retour_err"] = bank_err_order_transaction_url(order_transaction) + hsh["url_retour"] = options[:url_retour] || edit_order_url(order) + hsh["url_retour_ok"] = options[:url_retour_ok] || bank_ok_order_transaction_url(order_transaction) + hsh["url_retour_err"] = options[:url_retour_err] || bank_err_order_transaction_url(order_transaction) hsh["MAC"] = PaiementCic.calculate_hmac(oa) res = "\n"