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

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



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

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

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



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

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

  post = {}
  post[:ticketNumber] = authorization
  add_invoice(action, post, amount, options)

  commit(action, post)
end

#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



44
45
46
47
48
49
50
51
# File 'lib/active_merchant/billing/gateways/kushki.rb', line 44

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

  post = {}
  post[:ticketNumber] = authorization

  commit(action, post)
end

#scrub(transcript) ⇒ Object



66
67
68
69
70
71
# File 'lib/active_merchant/billing/gateways/kushki.rb', line 66

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)


62
63
64
# File 'lib/active_merchant/billing/gateways/kushki.rb', line 62

def supports_scrubbing?
  true
end

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



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

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

  post = {}
  post[:ticketNumber] = authorization

  commit(action, post)
end