lib/active_merchant/billing/gateways/quickpay.rb in jelaniharris-activemerchant-1.24.1 vs lib/active_merchant/billing/gateways/quickpay.rb in jelaniharris-activemerchant-1.29.1
- old
+ new
@@ -2,11 +2,11 @@
require 'digest/md5'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class QuickpayGateway < Gateway
- URL = 'https://secure.quickpay.dk/api'
+ self.live_url = self.test_url = 'https://secure.quickpay.dk/api'
self.default_currency = 'DKK'
self.money_format = :cents
self.supported_cardtypes = [:dankort, :forbrugsforeningen, :visa, :master, :american_express, :diners_club, :jcb, :maestro]
self.supported_countries = ['DK', 'SE']
@@ -91,11 +91,10 @@
# To use the API-key from the Quickpay manager, specify :api-key
# Using the API-key, requires that you use version 4. Specify :version => 4 in options.
def initialize(options = {})
requires!(options, :login, :password)
@protocol = options.delete(:version) || 3 # default to protocol version 3
- @options = options
super
end
def authorize(money, credit_card_or_reference, options = {})
post = {}
@@ -213,14 +212,14 @@
def add_description(post, options)
post[:description] = options[:description]
end
def add_testmode(post)
- return if post[:transaction].present?
+ return if post[:transaction].present?
post[:testmode] = test? ? '1' : '0'
end
-
+
def add_fraud_parameters(post, options)
if @protocol == 4
post[:fraud_remote_addr] = options[:fraud_remote_addr] if options[:fraud_remote_addr]
post[:fraud_http_accept] = options[:fraud_http_accept] if options[:fraud_http_accept]
post[:fraud_http_accept_language] = options[:fraud_http_accept_language] if options[:fraud_http_accept_language]
@@ -230,10 +229,10 @@
post[:fraud_http_user_agent] = options[:fraud_http_user_agent] if options[:fraud_http_user_agent]
end
end
def commit(action, params)
- response = parse(ssl_post(URL, post_data(action, params)))
+ response = parse(ssl_post(self.live_url, post_data(action, params)))
Response.new(successful?(response), message_from(response), response,
:test => test?,
:authorization => response[:transaction]
)