Class: ActiveMerchant::Billing::KushkiGateway

Inherits:
Gateway
  • Object
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?

Methods included from CreditCardFormatting

#expdate, #format

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.



15
16
17
18
# File 'lib/active_merchant/billing/gateways/kushki.rb', line 15

def initialize(options={})
  requires!(options, :public_merchant_id, :private_merchant_id)
  super
end

Instance Method Details

#purchase(amount, payment_method, options = {}) ⇒ Object



20
21
22
23
24
25
# File 'lib/active_merchant/billing/gateways/kushki.rb', line 20

def purchase(amount, payment_method, options={})
  MultiResponse.run() do |r|
    r.process { tokenize(amount, payment_method, options) }
    r.process { charge(amount, r.authorization, options) }
  end
end

#refund(amount, authorization, options = {}) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/active_merchant/billing/gateways/kushki.rb', line 27

def refund(amount, authorization, options={})
  action = 'refund'

  post = {}
  post[:ticketNumber] = authorization

  commit(action, post)
end

#scrub(transcript) ⇒ Object



49
50
51
52
53
54
# File 'lib/active_merchant/billing/gateways/kushki.rb', line 49

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

Returns:

  • (Boolean)


45
46
47
# File 'lib/active_merchant/billing/gateways/kushki.rb', line 45

def supports_scrubbing?
  true
end

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



36
37
38
39
40
41
42
43
# File 'lib/active_merchant/billing/gateways/kushki.rb', line 36

def void(authorization, options={})
  action = 'void'

  post = {}
  post[:ticketNumber] = authorization

  commit(action, post)
end