lib/opay/helpers/form_helper.rb in opay-1.2.0 vs lib/opay/helpers/form_helper.rb in opay-1.2.1
- old
+ new
@@ -3,14 +3,31 @@
module FormHelper
def opay_form_for(record, options = {}, &block)
# for future purposes
- payu_form_for(record, options, &block)
+ @payment_provider = options[:provider]
+
+ raise ArgumentError, 'Empty payment provider' if @payment_provider.blank? || Opay.config.providers.include?(@payment_provider) == false
+
+ case @payment_provider
+ when :payu
+ return payu_form_for(record, options, &block)
+ when :paypal
+ return paypal_form_for(record, options, &block)
+ end
+
end
def payment_info(options = {})
- payu_payment_info(options)
+ raise ArgumentError, 'Empty payment provider' if @options[:provider].blank? || Opay.config.providers.include?(@options[:provider]) == false
+
+ case @options[:provider]
+ when :payu
+ payu_payment_info(options)
+ when :paypal
+ paypal_payment_info(options)
+ end
end
end
end