Class: ActiveMerchant::Billing::DLocalGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/d_local.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?, #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 = {}) ⇒ DLocalGateway

Returns a new instance of DLocalGateway.



14
15
16
17
# File 'lib/active_merchant/billing/gateways/d_local.rb', line 14

def initialize(options = {})
  requires!(options, :login, :trans_key, :secret_key)
  super
end

Instance Method Details

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



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

def authorize(money, payment, options = {})
  post = {}
  add_auth_purchase_params(post, money, payment, 'authorize', options)
  add_three_ds(post, options)
  post[:card][:verify] = true if options[:verify].to_s == 'true'

  commit('authorize', post, options)
end

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



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

def capture(money, authorization, options = {})
  post = {}
  post[:authorization_id] = authorization
  add_invoice(post, money, options) if money
  commit('capture', post, options)
end

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



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

def inquire(authorization, options = {})
  post = {}
  post[:payment_id] = authorization
  action = authorization ? 'status' : 'orders'
  commit(action, post, options)
end

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



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

def purchase(money, payment, options = {})
  post = {}
  add_auth_purchase_params(post, money, payment, 'purchase', options)
  add_three_ds(post, options)

  commit('purchase', post, options)
end

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



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

def refund(money, authorization, options = {})
  post = {}
  add_description(post, options)
  post[:payment_id] = authorization
  post[:notification_url] = options[:notification_url]
  add_invoice(post, money, options) if money
  commit('refund', post, options)
end

#scrub(transcript) ⇒ Object



77
78
79
80
81
82
# File 'lib/active_merchant/billing/gateways/d_local.rb', line 77

def scrub(transcript)
  transcript.
    gsub(%r((X-Trans-Key: )\w+), '\1[FILTERED]').
    gsub(%r((\"number\\\":\\\")\d+), '\1[FILTERED]').
    gsub(%r((\"cvv\\\":\\\")\d+), '\1[FILTERED]')
end

#supports_network_tokenization?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/active_merchant/billing/gateways/d_local.rb', line 73

def supports_network_tokenization?
  true
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/active_merchant/billing/gateways/d_local.rb', line 69

def supports_scrubbing?
  true
end

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



58
59
60
# File 'lib/active_merchant/billing/gateways/d_local.rb', line 58

def verify(credit_card, options = {})
  authorize(0, credit_card, options.merge(verify: 'true'))
end

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



52
53
54
55
56
# File 'lib/active_merchant/billing/gateways/d_local.rb', line 52

def void(authorization, options = {})
  post = {}
  post[:authorization_id] = authorization
  commit('void', post, options)
end