Class: ActiveMerchant::Billing::DeepstackGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/deepstack.rb

Constant Summary collapse

STANDARD_ERROR_CODE_MAPPING =
{}

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, #strftime_yyyymm

Methods included from PostsData

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

Constructor Details

#initialize(options = {}) ⇒ DeepstackGateway

Returns a new instance of DeepstackGateway.



17
18
19
20
21
# File 'lib/active_merchant/billing/gateways/deepstack.rb', line 17

def initialize(options = {})
  requires!(options, :publishable_api_key, :app_id, :shared_secret)
  @publishable_api_key, @app_id, @shared_secret = options.values_at(:publishable_api_key, :app_id, :shared_secret)
  super
end

Instance Method Details

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



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

def authorize(money, payment, options = {})
  post = {}
  add_payment(post, payment, options)
  add_order(post, money, options)
  add_address(post, payment, options)
  add_customer_data(post, options)

  commit('auth', post)
end

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



43
44
45
46
47
48
# File 'lib/active_merchant/billing/gateways/deepstack.rb', line 43

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

  commit('capture', post)
end

#get_token(credit_card, options = {}) ⇒ Object



69
70
71
72
73
74
# File 'lib/active_merchant/billing/gateways/deepstack.rb', line 69

def get_token(credit_card, options = {})
  post = {}
  add_payment_instrument(post, credit_card, options)
  add_address_payment_instrument(post, credit_card, options)
  commit('gettoken', post)
end

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



23
24
25
26
27
28
29
30
31
# File 'lib/active_merchant/billing/gateways/deepstack.rb', line 23

def purchase(money, payment, options = {})
  post = {}
  add_payment(post, payment, options)
  add_order(post, money, options)
  add_purchase_capture(post)
  add_address(post, payment, options)
  add_customer_data(post, options)
  commit('sale', post)
end

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



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

def refund(money, authorization, options = {})
  post = {}
  add_invoice(post, money, authorization, options)
  commit('refund', post)
end

#scrub(transcript) ⇒ Object



80
81
82
83
84
85
86
87
88
# File 'lib/active_merchant/billing/gateways/deepstack.rb', line 80

def scrub(transcript)
  transcript.
    gsub(%r((Authorization: Bearer )\w+), '\1[FILTERED]').
    gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
    gsub(%r((Hmac: )[\w=]+), '\1[FILTERED]').
    gsub(%r((\\"account_number\\":\\")[\w*]+), '\1[FILTERED]').
    gsub(%r((\\"cvv\\":\\")\w+), '\1[FILTERED]').
    gsub(%r((\\"expiration\\":\\")\w+), '\1[FILTERED]')
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/active_merchant/billing/gateways/deepstack.rb', line 76

def supports_scrubbing?
  true
end

#verify(credit_card, options = {}) ⇒ Object



62
63
64
65
66
67
# File 'lib/active_merchant/billing/gateways/deepstack.rb', line 62

def verify(credit_card, options = {})
  MultiResponse.run(:use_first_response) do |r|
    r.process { authorize(100, credit_card, options) }
    r.process(:ignore_result) { void(0, r.authorization, options) }
  end
end

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



56
57
58
59
60
# File 'lib/active_merchant/billing/gateways/deepstack.rb', line 56

def void(money, authorization, options = {})
  post = {}
  add_invoice(post, money, authorization, options)
  commit('void', post)
end