Class: ActiveMerchant::Billing::QuickpayV4to7Gateway

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

Constant Summary collapse

APPROVED =
'000'

Constants included from QuickpayCommon

QuickpayCommon::MD5_CHECK_FIELDS, QuickpayCommon::RESPONSE_CODES

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods included from QuickpayCommon

included

Methods inherited from Gateway

#card_brand, card_brand, #generate_unique_id, inherited, non_fractional_currency?, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?

Methods included from CreditCardFormatting

#format

Methods included from PostsData

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

Constructor Details

#initialize(options = {}) ⇒ QuickpayV4to7Gateway

The login is the QuickpayId The password is the md5checkword from the Quickpay manager 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/5/6/7 in options.



16
17
18
19
20
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb', line 16

def initialize(options = {})
  requires!(options, :login, :password)
  @protocol = options.delete(:version) || 7 # default to protocol version 7
  super
end

Instance Method Details

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



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb', line 22

def authorize(money, credit_card_or_reference, options = {})
  post = {}

  action = recurring_or_authorize(credit_card_or_reference)

  add_amount(post, money, options)
  add_invoice(post, options)
  add_creditcard_or_reference(post, credit_card_or_reference, options)
  add_autocapture(post, false)
  add_fraud_parameters(post, options) if action.eql?(:authorize)
  add_testmode(post)

  commit(action, post)
end

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



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

def capture(money, authorization, options = {})
  post = {}

  add_finalize(post, options)
  add_reference(post, authorization)
  add_amount_without_currency(post, money)
  commit(:capture, post)
end

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



77
78
79
80
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb', line 77

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

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



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

def purchase(money, credit_card_or_reference, options = {})
  post = {}

  action = recurring_or_authorize(credit_card_or_reference)

  add_amount(post, money, options)
  add_creditcard_or_reference(post, credit_card_or_reference, options)
  add_invoice(post, options)
  add_fraud_parameters(post, options) if action.eql?(:authorize)
  add_autocapture(post, true)

  commit(action, post)
end

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



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

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

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

  commit(:refund, post)
end

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



82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb', line 82

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

  add_creditcard(post, creditcard, options)
  add_amount(post, 0, options) if @protocol >= 7
  add_invoice(post, options)
  add_description(post, options)
  add_fraud_parameters(post, options)
  add_testmode(post)

  commit(:subscribe, post)
end

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



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

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

  add_reference(post, identification)

  commit(:cancel, post)
end