lib/active_merchant/billing/gateways/authorize_net.rb in activemerchant-1.4.1 vs lib/active_merchant/billing/gateways/authorize_net.rb in activemerchant-1.4.2

- old
+ new

@@ -31,10 +31,12 @@ self.test_url = "https://test.authorize.net/gateway/transact.dll" self.live_url = "https://secure.authorize.net/gateway/transact.dll" self.arb_test_url = 'https://apitest.authorize.net/xml/v1/request.api' self.arb_live_url = 'https://api.authorize.net/xml/v1/request.api' + + class_inheritable_accessor :duplicate_window APPROVED, DECLINED, ERROR, FRAUD_REVIEW = 1, 2, 3, 4 RESPONSE_CODE, RESPONSE_REASON_CODE, RESPONSE_REASON_TEXT = 0, 2, 3 AVS_RESULT_CODE, TRANSACTION_ID, CARD_CODE_RESPONSE_CODE = 5, 6, 38 @@ -84,10 +86,11 @@ post = {} add_invoice(post, options) add_creditcard(post, creditcard) add_address(post, options) add_customer_data(post, options) + add_duplicate_window(post) commit('AUTH_ONLY', money, post) end # Perform a purchase, which is essentially an authorization and capture in a single operation. @@ -101,10 +104,11 @@ post = {} add_invoice(post, options) add_creditcard(post, creditcard) add_address(post, options) add_customer_data(post, options) + add_duplicate_window(post) commit('AUTH_CAPTURE', money, post) end # Captures the funds from an authorized transaction. @@ -315,9 +319,18 @@ post[:cust_id] = options[:customer] end if options.has_key? :ip post[:customer_ip] = options[:ip] + end + end + + # x_duplicate_window won't be sent by default, because sending it changes the response. + # "If this field is present in the request with or without a value, an enhanced duplicate transaction response will be sent." + # (as of 2008-12-30) http://www.authorize.net/support/AIM_guide_SCC.pdf + def add_duplicate_window(post) + unless duplicate_window.nil? + post[:duplicate_window] = duplicate_window end end def add_address(post, options)