lib/active_merchant/billing/gateways/authorize_net.rb in activemerchant-1.42.2 vs lib/active_merchant/billing/gateways/authorize_net.rb in activemerchant-1.42.3
- old
+ new
@@ -49,10 +49,11 @@
self.display_name = 'Authorize.Net'
CARD_CODE_ERRORS = %w( N S )
AVS_ERRORS = %w( A E N R W Z )
AVS_REASON_CODES = %w(27 45)
+ TRANSACTION_ALREADY_ACTIONED = %w(310 311)
AUTHORIZE_NET_ARB_NAMESPACE = 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'
RECURRING_ACTIONS = {
:create => 'ARBCreateSubscription',
@@ -197,11 +198,11 @@
# If <tt>:unit</tt> is <tt>:months</tt> then <tt>:length</tt> must be an integer between 1 and 12 inclusive.
# If <tt>:unit</tt> is <tt>:days</tt> then <tt>:length</tt> must be an integer between 7 and 365 inclusive.
# For example, to charge the customer once every three months the hash would be
# +:interval => { :unit => :months, :length => 3 }+ (REQUIRED)
# * <tt>:duration</tt> -- A hash containing keys for the <tt>:start_date</tt> the subscription begins (also the date the
- # initial billing occurs) and the total number of billing <tt>:occurences</tt> or payments for the subscription. (REQUIRED)
+ # initial billing occurs) and the total number of billing <tt>:occurrences</tt> or payments for the subscription. (REQUIRED)
def recurring(money, creditcard, options={})
requires!(options, :interval, :duration, :billing_address)
requires!(options[:interval], :length, [:unit, :days, :months])
requires!(options[:duration], :start_date, :occurrences)
requires!(options[:billing_address], :first_name, :last_name)
@@ -292,10 +293,10 @@
:cvv_result => response[:card_code]
)
end
def success?(response)
- response[:response_code] == APPROVED
+ response[:response_code] == APPROVED && TRANSACTION_ALREADY_ACTIONED.exclude?(response[:response_reason_code])
end
def fraud_review?(response)
response[:response_code] == FRAUD_REVIEW
end