lib/active_merchant/billing/gateways/sage_pay.rb in activemerchant-1.60.0 vs lib/active_merchant/billing/gateways/sage_pay.rb in activemerchant-1.61.0

- old
+ new

@@ -173,10 +173,21 @@ gsub(%r((&?CardNumber=)\d+(&?)), '\1[FILTERED]\2'). gsub(%r((&?CV2=)\d+(&?)), '\1[FILTERED]\2') end private + def truncate(value, max_size) + return nil unless value + return value.to_s if CGI.escape(value.to_s).length <= max_size + + if value.size > max_size + truncate(super(value, max_size), max_size) + else + truncate(value.to_s.chop, max_size) + end + end + def add_reference(post, identification) order_id, transaction_id, authorization, security_key = identification.split(';') add_pair(post, :VendorTxCode, order_id) add_pair(post, :VPSTxId, transaction_id) @@ -279,9 +290,10 @@ end def add_token_details(post, token, options) add_token(post, token) add_pair(post, :StoreToken, options[:customer]) + add_pair(post, :CV2, options[:verification_value]) end def add_token(post, token) add_pair(post, :Token, token) end