app/helpers/supercharged/charges_helper.rb in supercharged-2.0.4 vs app/helpers/supercharged/charges_helper.rb in supercharged-2.1.0
- old
+ new
@@ -1,8 +1,7 @@
module Supercharged::ChargesHelper
# No order id while generating form. It will be added later via JS
- # JS finds order input by this fake id because id and name will be integration specific
FAKE_ORDER_ID = "[payment_order_id]"
def charge_form_for(service_name, options = {}, &block)
raise ArgumentError, "Missing block" unless block_given?
@@ -10,14 +9,15 @@
options.merge!(default_options)
options = with_default_html_options(options)
account = options.delete(:account)
- notify_url = gateways_result_url(service_name)
payment_service_for(FAKE_ORDER_ID, account, options) do |service|
- service.notify_url notify_url
+ service.notify_url gateways_result_url(service_name)
+ service.return_url root_url
+ service.cancel_return_url new_charge_url
block.call(service)
end
end
def charge_form_amount_field(service, options = {})
@@ -38,12 +38,10 @@
def default_amount_field_options
{
role: "charge-amount",
required: true,
- data: {
- min_value: Charge.min_amount
- }
+ min: Charge.new(user: current_user).min_amount
}
end
end