Class: ActiveMerchant::Billing::QuickpayV10Gateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::QuickpayV10Gateway
show all
- Includes:
- QuickpayCommon
- Defined in:
- lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb
Constant Summary
collapse
- API_VERSION =
10
QuickpayCommon::MD5_CHECK_FIELDS, QuickpayCommon::RESPONSE_CODES
Constants inherited
from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
#options
Instance Method Summary
collapse
-
#authorize(money, credit_card_or_reference, options = {}) ⇒ Object
-
#capture(money, identification, options = {}) ⇒ Object
-
#credit(money, identification, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ QuickpayV10Gateway
constructor
A new instance of QuickpayV10Gateway.
-
#purchase(money, credit_card_or_reference, options = {}) ⇒ Object
-
#refund(money, identification, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#store(credit_card, options = {}) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#unstore(identification) ⇒ Object
-
#verify(credit_card, options = {}) ⇒ Object
-
#void(identification, _options = {}) ⇒ Object
#expdate, included
Methods inherited from Gateway
#card_brand, card_brand, #generate_unique_id, inherited, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #test?
#expdate, #format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of QuickpayV10Gateway.
12
13
14
15
|
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 12
def initialize(options = {})
requires!(options, :api_key)
super
end
|
Instance Method Details
#authorize(money, credit_card_or_reference, options = {}) ⇒ Object
32
33
34
35
36
37
38
39
40
|
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 32
def authorize(money, credit_card_or_reference, options = {})
MultiResponse.run(true) do |r|
r.process { create_payment(money, options) }
r.process {
post = authorization_params(money, credit_card_or_reference, options)
commit(synchronized_path("/payments/#{r.authorization}/authorize"), post)
}
end
end
|
#capture(money, identification, options = {}) ⇒ Object
51
52
53
54
|
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 51
def capture(money, identification, options = {})
post = capture_params(money, identification, options)
commit(synchronized_path("/payments/#{identification}/capture"), post)
end
|
#credit(money, identification, options = {}) ⇒ Object
#purchase(money, credit_card_or_reference, options = {}) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 17
def purchase(money, credit_card_or_reference, options = {})
MultiResponse.run(true) do |r|
r.process { create_payment(money, options) }
r.process {
post = authorization_params(money, credit_card_or_reference, options)
add_autocapture(post, false)
commit(synchronized_path("/payments/#{r.authorization}/authorize"), post)
}
r.process {
post = capture_params(money, credit_card_or_reference, options)
commit(synchronized_path("/payments/#{r.authorization}/capture"), post)
}
end
end
|
#refund(money, identification, options = {}) ⇒ Object
56
57
58
59
60
61
|
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 56
def refund(money, identification, options = {})
post = {}
add_amount(post, money, options)
add_additional_params(:refund, post, options)
commit(synchronized_path("/payments/#{identification}/refund"), post)
end
|
#scrub(transcript) ⇒ Object
87
88
89
90
91
92
|
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 87
def scrub(transcript)
transcript.
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
gsub(%r(("card\\?":{\\?"number\\?":\\?")\d+), '\1[FILTERED]').
gsub(%r(("cvd\\?":\\?")\d+), '\1[FILTERED]')
end
|
#store(credit_card, options = {}) ⇒ Object
70
71
72
73
74
75
76
|
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 70
def store(credit_card, options = {})
MultiResponse.run do |r|
r.process { create_store(options) }
r.process { authorize_store(r.authorization, credit_card, options)}
r.process { create_token(r.authorization, options.merge({id: r.authorization}))}
end
end
|
#supports_scrubbing? ⇒ Boolean
83
84
85
|
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 83
def supports_scrubbing?
true
end
|
#unstore(identification) ⇒ Object
78
79
80
81
|
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 78
def unstore(identification)
identification = identification.split(";").last
commit(synchronized_path "/cards/#{identification}/cancel")
end
|
#verify(credit_card, options = {}) ⇒ Object
63
64
65
66
67
68
|
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 63
def verify(credit_card, options={})
MultiResponse.run(:use_first_response) do |r|
r.process { authorize(100, credit_card, options) }
r.process(:ignore_result) { void(r.authorization, options) }
end
end
|
#void(identification, _options = {}) ⇒ Object
42
43
44
|
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 42
def void(identification, _options = {})
commit(synchronized_path "/payments/#{identification}/cancel")
end
|