Class: ActiveMerchant::Billing::KushkiGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::KushkiGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/kushki.rb
Constant Summary
Constants inherited
from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
#options
Instance Method Summary
collapse
Methods inherited from Gateway
#add_field_to_post_if_present, #add_fields_to_post_if_present, #card_brand, card_brand, #generate_unique_id, inherited, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #test?
#fetch_version, included
#expdate, #format, #strftime_yyyymm, #strftime_yyyymmdd_last_day
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ KushkiGateway
Returns a new instance of KushkiGateway.
18
19
20
21
|
# File 'lib/active_merchant/billing/gateways/kushki.rb', line 18
def initialize(options = {})
requires!(options, :public_merchant_id, :private_merchant_id)
super
end
|
Instance Method Details
#authorize(amount, payment_method, options = {}) ⇒ Object
30
31
32
33
34
35
|
# File 'lib/active_merchant/billing/gateways/kushki.rb', line 30
def authorize(amount, payment_method, options = {})
MultiResponse.run() do |r|
r.process { tokenize(amount, payment_method, options) }
r.process { preauthorize(amount, r.authorization, options, payment_method) }
end
end
|
#capture(amount, authorization, options = {}) ⇒ Object
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/active_merchant/billing/gateways/kushki.rb', line 37
def capture(amount, authorization, options = {})
action = 'capture'
post = {}
post[:ticketNumber] = authorization
add_invoice(action, post, amount, options)
add_full_response(post, options)
commit(action, post)
end
|
#purchase(amount, payment_method, options = {}) ⇒ Object
23
24
25
26
27
28
|
# File 'lib/active_merchant/billing/gateways/kushki.rb', line 23
def purchase(amount, payment_method, options = {})
MultiResponse.run() do |r|
r.process { tokenize(amount, payment_method, options) }
r.process { charge(amount, r.authorization, options, payment_method) }
end
end
|
#refund(amount, authorization, options = {}) ⇒ Object
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/active_merchant/billing/gateways/kushki.rb', line 48
def refund(amount, authorization, options = {})
action = 'refund'
post = {}
post[:ticketNumber] = authorization
add_full_response(post, options)
add_invoice(action, post, amount, options)
commit(action, post, options)
end
|
#scrub(transcript) ⇒ Object
73
74
75
76
77
78
|
# File 'lib/active_merchant/billing/gateways/kushki.rb', line 73
def scrub(transcript)
transcript.
gsub(%r((Private-Merchant-Id: )\d+), '\1[FILTERED]').
gsub(%r((\"card\\\":{\\\"number\\\":\\\")\d+), '\1[FILTERED]').
gsub(%r((\"cvv\\\":\\\")\d+), '\1[FILTERED]')
end
|
#supports_scrubbing? ⇒ Boolean
69
70
71
|
# File 'lib/active_merchant/billing/gateways/kushki.rb', line 69
def supports_scrubbing?
true
end
|
#void(authorization, options = {}) ⇒ Object
59
60
61
62
63
64
65
66
67
|
# File 'lib/active_merchant/billing/gateways/kushki.rb', line 59
def void(authorization, options = {})
action = 'void'
post = {}
post[:ticketNumber] = authorization
add_full_response(post, options)
commit(action, post)
end
|