lib/active_merchant/billing/gateways/realex.rb in activemerchant-1.28.0 vs lib/active_merchant/billing/gateways/realex.rb in activemerchant-1.29.0

- old
+ new

@@ -18,11 +18,11 @@ # the Realex team decided to make the orderid unique per request, # so if validation fails you can not correct and resend using the # same order id class RealexGateway < Gateway self.live_url = self.test_url = 'https://epage.payandshop.com/epage-remote.cgi' - + CARD_MAPPING = { 'master' => 'MC', 'visa' => 'VISA', 'american_express' => 'AMEX', 'diners_club' => 'DINERS', @@ -43,11 +43,10 @@ ERROR = CLIENT_DEACTIVATED = "Gateway Error" def initialize(options = {}) requires!(options, :login, :password) options[:refund_hash] = Digest::SHA1.hexdigest(options[:rebate_secret]) if options.has_key?(:rebate_secret) - @options = options super end def purchase(money, credit_card, options = {}) requires!(options, :order_id) @@ -79,14 +78,14 @@ end def void(authorization, options = {}) request = build_void_request(authorization, options) commit(request) - end - - private - def commit(request) + end + + private + def commit(request) response = parse(ssl_post(self.live_url, request)) Response.new(response[:result] == "00", message_from(response), response, :test => response[:message] =~ /\[ test system \]/, :authorization => authorization_from(response), @@ -186,11 +185,11 @@ xml.tag! 'prodid', options[:invoice] if options[:invoice] xml.tag! 'custipaddress', options[:ip] if options[:ip] if billing_address xml.tag! 'address', 'type' => 'billing' do - xml.tag! 'code', avs_input_code( billing_address ) + xml.tag! 'code', format_shipping_zip_code(billing_address[:zip]) xml.tag! 'country', billing_address[:country] end end if shipping_address @@ -239,20 +238,11 @@ xml.tag! 'presind', (options['presind'] || (credit_card.verification_value? ? 1 : nil)) end end end - def avs_input_code(address) - address.values_at(:zip, :address1).map{ |v| extract_digits(v) }.join('|') - end - def format_shipping_zip_code(zip) zip.to_s.gsub(/\W/, '') - end - - def extract_digits(string) - return "" if string.nil? - string.gsub(/[\D]/,'') end def new_timestamp Time.now.strftime('%Y%m%d%H%M%S') end