lib/active_merchant/billing/integrations/helper.rb in activemerchant-1.20.4 vs lib/active_merchant/billing/integrations/helper.rb in activemerchant-1.21.0

- old
+ new

@@ -12,12 +12,13 @@ # Useful for things like the PayPal build notation (BN) id fields class_attribute :application_id self.application_id = 'ActiveMerchant' def initialize(order, account, options = {}) - options.assert_valid_keys([:amount, :currency, :test, :credential2, :credential3, :credential4, :country, :account_name]) + options.assert_valid_keys([:amount, :currency, :test, :credential2, :credential3, :credential4, :country, :account_name, :transaction_type]) @fields = {} + @raw_html_fields = [] @test = options[:test] self.order = order self.account = account self.amount = options[:amount] self.currency = options[:currency] @@ -39,9 +40,20 @@ def add_fields(subkey, params = {}) params.each do |k, v| field = mappings[subkey][k] add_field(field, v) unless field.blank? end + end + + # Add a field that has characters that CGI::escape would mangle. Allows + # for multiple fields with the same name (e.g., to support line items). + def add_raw_html_field(name, value) + return if name.blank? || value.blank? + @raw_html_fields << [name, value] + end + + def raw_html_fields + @raw_html_fields end def billing_address(params = {}) add_address(:billing_address, params) end