lib/active_merchant/billing/gateways/authorize_net.rb in activemerchant-1.48.0 vs lib/active_merchant/billing/gateways/authorize_net.rb in activemerchant-1.49.0
- old
+ new
@@ -20,11 +20,11 @@
'36' => STANDARD_ERROR_CODE[:incorrect_number],
'237' => STANDARD_ERROR_CODE[:invalid_number],
'2315' => STANDARD_ERROR_CODE[:invalid_number],
'37' => STANDARD_ERROR_CODE[:invalid_expiry_date],
'2316' => STANDARD_ERROR_CODE[:invalid_expiry_date],
- '378' => STANDARD_ERROR_CODE[:invalid_cvc],
+ '378' => STANDARD_ERROR_CODE[:invalid_cvc],
'38' => STANDARD_ERROR_CODE[:expired_card],
'2317' => STANDARD_ERROR_CODE[:expired_card],
'244' => STANDARD_ERROR_CODE[:incorrect_cvc],
'227' => STANDARD_ERROR_CODE[:incorrect_address],
'2127' => STANDARD_ERROR_CODE[:incorrect_address],
@@ -230,13 +230,13 @@
if credit_card.track_data
add_swipe_data(xml, credit_card)
else
xml.payment do
xml.creditCard do
- xml.cardNumber(credit_card.number)
+ xml.cardNumber(truncate(credit_card.number, 16))
xml.expirationDate(format(credit_card.month, :two_digits) + '/' + format(credit_card.year, :four_digits))
- unless empty?(credit_card.verification_value)
+ if credit_card.valid_card_verification_value?(credit_card.verification_value, credit_card.brand)
xml.cardCode(credit_card.verification_value)
end
if credit_card.is_a?(NetworkTokenizationCreditCard)
xml.cryptogram(credit_card.payment_cryptogram)
end
@@ -484,13 +484,9 @@
def fraud_review?(response)
(response[:response_code] == FRAUD_REVIEW)
end
- def truncate(value, max_size)
- return nil unless value
- value.to_s[0, max_size]
- end
def using_live_gateway_in_test_mode?(response)
!test? && response[:test_request] == "1"
end