Module: Supercharged::ChargesHelper
- Defined in:
- app/helpers/supercharged/charges_helper.rb
Constant Summary collapse
- FAKE_ORDER_ID =
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
"[payment_order_id]"
Instance Method Summary collapse
- #charge_form_amount_field(service, options = {}) ⇒ Object
- #charge_form_for(service_name, options = {}, &block) ⇒ Object
Instance Method Details
#charge_form_amount_field(service, options = {}) ⇒ Object
23 24 25 26 27 28 29 |
# File 'app/helpers/supercharged/charges_helper.rb', line 23 def charge_form_amount_field(service, = {}) amount_field_name = service.mappings[:amount] || raise(ArgumentError, "Undefined amount field mapping") = .merge() number_field_tag amount_field_name, nil, end |
#charge_form_for(service_name, options = {}, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/helpers/supercharged/charges_helper.rb', line 6 def charge_form_for(service_name, = {}, &block) raise ArgumentError, "Missing block" unless block_given? = {service: service_name} .merge!() = () account = .delete(:account) notify_url = gateways_result_url(service_name) payment_service_for(FAKE_ORDER_ID, account, ) do |service| service.notify_url notify_url block.call(service) end end |