Class: ActiveMerchant::Billing::DecidirPlusGateway

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

Returns a new instance of DecidirPlusGateway.



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

def initialize(options = {})
  requires!(options, :public_key, :private_key)
  super
end

Instance Method Details

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



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

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

  add_payment(post, payment, options)
  add_purchase_data(post, money, payment, options)

  commit(:post, 'payments', post)
end

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



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

def refund(money, authorization, options = {})
  post = {}
  post[:amount] = money

  commit(:post, "payments/#{add_reference(authorization)}/refunds")
end

#scrub(transcript) ⇒ Object



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

def scrub(transcript)
  transcript.
    gsub(%r((Apikey: )\w+), '\1[FILTERED]').
    gsub(%r(("card_number\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
    gsub(%r(("security_code\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]')
end

#store(payment, options = {}) ⇒ Object



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

def store(payment, options = {})
  post = {}
  add_payment(post, payment, options)

  commit(:post, 'tokens', post)
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/active_merchant/billing/gateways/decidir_plus.rb', line 42

def supports_scrubbing?
  true
end