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, :testmode],
  :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, :testmode],
  :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
49
# 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)
  add_testmode(post)

  commit(recurring_or_authorize(credit_card_or_reference), post)
end

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



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

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



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

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

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



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

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



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

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

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

  commit(:refund, post)
end

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



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

def store(creditcard, options = {})
  post = {}

  add_creditcard(post, creditcard, options)
  add_invoice(post, options)
  add_description(post, options)
  add_testmode(post)

  commit(:subscribe, post)
end

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



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

def void(identification, options = {})
  post = {}

  add_reference(post, identification)

  commit(:cancel, post)
end