lib/active_merchant/billing/gateways/wirecard.rb in activemerchant-1.42.5 vs lib/active_merchant/billing/gateways/wirecard.rb in activemerchant-1.42.6
- old
+ new
@@ -69,10 +69,14 @@
commit(:bookback, money, options)
end
private
+ def clean_description(description)
+ description.to_s.slice(0,32).encode("US-ASCII", invalid: :replace, undef: :replace, replace: '?')
+ end
+
def prepare_options_hash(options)
result = @options.merge(options)
setup_address_hash!(result)
result
end
@@ -137,10 +141,10 @@
# Includes the whole transaction data (payment, creditcard, address)
def add_transaction_data(xml, money, options)
options[:order_id] ||= generate_unique_id
xml.tag! "FNC_CC_#{options[:action].to_s.upcase}" do
- xml.tag! 'FunctionID', options[:description].to_s.slice(0,32)
+ xml.tag! 'FunctionID', clean_description(options[:description])
xml.tag! 'CC_TRANSACTION' do
xml.tag! 'TransactionID', options[:order_id]
case options[:action]
when :preauthorization, :purchase
add_invoice(xml, money, options)