lib/active_merchant/billing/gateways/sage_pay.rb in activemerchant-1.42.5 vs lib/active_merchant/billing/gateways/sage_pay.rb in activemerchant-1.42.6
- old
+ new
@@ -189,11 +189,11 @@
end
end
def add_invoice(post, options)
add_pair(post, :VendorTxCode, sanitize_order_id(options[:order_id]), :required => true)
- add_pair(post, :Description, options[:description] || options[:order_id])
+ add_pair(post, :Description, truncate_description(options[:description] || options[:order_id]))
end
def add_credit_card(post, credit_card)
add_pair(post, :CardHolder, credit_card.name, :required => true)
add_pair(post, :CardNumber, credit_card.number, :required => true)
@@ -209,9 +209,14 @@
add_pair(post, :CV2, credit_card.verification_value)
end
def sanitize_order_id(order_id)
order_id.to_s.gsub(/[^-a-zA-Z0-9._]/, '')
+ end
+
+ def truncate_description(description)
+ return nil unless description
+ description[0, 100]
end
def map_card_type(credit_card)
raise ArgumentError, "The credit card type must be provided" if card_brand(credit_card).blank?