lib/active_merchant/billing/gateways/iridium.rb in activemerchant-1.43.3 vs lib/active_merchant/billing/gateways/iridium.rb in activemerchant-1.44.0
- old
+ new
@@ -204,10 +204,26 @@
"ZAR" => '710',
"ZMK" => '894',
"ZWD" => '716',
}
+ AVS_CODE = {
+ "PASSED" => "Y",
+ "FAILED" => "N",
+ "PARTIAL" => "X",
+ "NOT_CHECKED" => "X",
+ "UNKNOWN" => "X"
+ }
+
+ CVV_CODE = {
+ "PASSED" => "M",
+ "FAILED" => "N",
+ "PARTIAL" => "I",
+ "NOT_CHECKED" => "P",
+ "UNKNOWN" => "U"
+ }
+
def initialize(options = {})
requires!(options, :login, :password)
super
end
@@ -234,11 +250,11 @@
def capture(money, authorization, options = {})
commit(build_reference_request('COLLECTION', money, authorization, options), options)
end
def credit(money, authorization, options={})
- deprecated CREDIT_DEPRECATION_MESSAGE
+ ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
refund(money, authorization, options)
end
def refund(money, authorization, options={})
commit(build_reference_request('REFUND', money, authorization, options), options)
@@ -259,11 +275,11 @@
end
end
def build_reference_request(type, money, authorization, options)
options.merge!(:action => 'CrossReferenceTransaction')
- order_id, cross_reference, auth_id = authorization.split(";")
+ order_id, cross_reference, _ = authorization.split(";")
build_request(options) do |xml|
if money
details = {'CurrencyCode' => currency_code(options[:currency] || default_currency), 'Amount' => amount(money)}
else
details = {'CurrencyCode' => currency_code(default_currency), 'Amount' => '0'}
@@ -357,10 +373,16 @@
message = response[:transaction_result][:message]
authorization = success ? [ options[:order_id], response[:transaction_output_data][:cross_reference], response[:transaction_output_data][:auth_code] ].compact.join(";") : nil
Response.new(success, message, response,
:test => test?,
- :authorization => authorization)
+ :authorization => authorization,
+ :avs_result => {
+ :street_match => AVS_CODE[ response[:transaction_output_data][:address_numeric_check_result] ],
+ :postal_match => AVS_CODE[ response[:transaction_output_data][:post_code_check_result] ],
+ },
+ :cvv_result => CVV_CODE[ response[:transaction_output_data][:cv2_check_result] ]
+ )
end
def parse(xml)
reply = {}
xml = REXML::Document.new(xml)