Class: ActiveMerchant::Billing::QuickpayGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/quickpay.rb

Constant Summary collapse

URL =
'https://secure.quickpay.dk/api'
PROTOCOL =
3
MD5_CHECK_FIELDS =
{
  :authorize => [:protocol, :msgtype, :merchant, :ordernumber, :amount, :currency, :autocapture, :cardnumber, :expirationdate, :cvd, :cardtypelock],
  :capture   => [:protocol, :msgtype, :merchant, :amount, :transaction],
  :cancel    => [:protocol, :msgtype, :merchant, :transaction],
  :refund    => [:protocol, :msgtype, :merchant, :amount, :transaction],
  :subscribe => [:protocol, :msgtype, :merchant, :ordernumber, :cardnumber, :expirationdate, :cvd, :cardtypelock, :description],
  :recurring => [:protocol, :msgtype, :merchant, :ordernumber, :amount, :currency, :autocapture, :transaction],
  :status    => [:protocol, :msgtype, :merchant, :transaction],
  :chstatus  => [:protocol, :msgtype, :merchant],
}
APPROVED =
'000'

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, inherited, supports?, #test?

Methods included from Utils

#deprecated, generate_unique_id

Methods included from CreditCardFormatting

#format

Methods included from RequiresParameters

#requires!

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Constructor Details

#initialize(options = {}) ⇒ QuickpayGateway

The login is the QuickpayId The password is the md5checkword from the Quickpay admin interface



33
34
35
36
37
# File 'lib/active_merchant/billing/gateways/quickpay.rb', line 33

def initialize(options = {})
  requires!(options, :login, :password)
  @options = options
  super
end

Instance Method Details

#authorize(money, credit_card_or_reference, options = {}) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/active_merchant/billing/gateways/quickpay.rb', line 39

def authorize(money, credit_card_or_reference, options = {})
  post = {}
  
  add_amount(post, money, options)
  add_invoice(post, options)
  add_creditcard_or_reference(post, credit_card_or_reference, options)
  add_autocapture(post, false)

  commit(recurring_or_authorize(credit_card_or_reference), post)
end

#capture(money, authorization, options = {}) ⇒ Object



61
62
63
64
65
66
67
68
# File 'lib/active_merchant/billing/gateways/quickpay.rb', line 61

def capture(money, authorization, options = {})
  post = {}
  
  add_reference(post, authorization)
  add_amount_without_currency(post, money)
  
  commit(:capture, post)
end

#credit(money, identification, options = {}) ⇒ Object



87
88
89
90
# File 'lib/active_merchant/billing/gateways/quickpay.rb', line 87

def credit(money, identification, options = {})
  deprecated CREDIT_DEPRECATION_MESSAGE
  refund(money, identification, options)      
end

#purchase(money, credit_card_or_reference, options = {}) ⇒ Object



50
51
52
53
54
55
56
57
58
59
# File 'lib/active_merchant/billing/gateways/quickpay.rb', line 50

def purchase(money, credit_card_or_reference, options = {})
  post = {}
  
  add_amount(post, money, options)
  add_creditcard_or_reference(post, credit_card_or_reference, options)
  add_invoice(post, options)
  add_autocapture(post, true)

  commit(recurring_or_authorize(credit_card_or_reference), post)
end

#refund(money, identification, options = {}) ⇒ Object



78
79
80
81
82
83
84
85
# File 'lib/active_merchant/billing/gateways/quickpay.rb', line 78

def refund(money, identification, options = {})
  post = {}

  add_amount_without_currency(post, money)
  add_reference(post, identification)

  commit(:refund, post)
end

#store(creditcard, options = {}) ⇒ Object



92
93
94
95
96
97
98
99
100
# File 'lib/active_merchant/billing/gateways/quickpay.rb', line 92

def store(creditcard, options = {})                       
  post = {}
  
  add_creditcard(post, creditcard, options)
  add_invoice(post, options)
  add_description(post, options)

  commit(:subscribe, post)
end

#void(identification, options = {}) ⇒ Object



70
71
72
73
74
75
76
# File 'lib/active_merchant/billing/gateways/quickpay.rb', line 70

def void(identification, options = {})
  post = {}
  
  add_reference(post, identification)
  
  commit(:cancel, post)
end