Class: ActiveMerchant::Billing::AleloGateway

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

Returns a new instance of AleloGateway.



19
20
21
22
# File 'lib/active_merchant/billing/gateways/alelo.rb', line 19

def initialize(options = {})
  requires!(options, :client_id, :client_secret)
  super
end

Instance Method Details

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



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

def purchase(money, payment, options = {})
  post = {}
  add_order(post, options)
  add_amount(post, money)
  add_payment(post, payment)
  add_geolocation(post, options)
  add_extra_data(post, options)

  commit('capture/transaction', post, options)
end

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



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

def refund(money, authorization, options = {})
  request_id = authorization.split('#').first
  options[:http] = { method: :put, prevent_encrypt: true }
  commit('capture/transaction/refund', { requestId: request_id }, options, :put)
end

#scrub(transcript) ⇒ Object



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

def scrub(transcript)
  force_utf8(transcript.encode).
    gsub(%r((Authorization: Bearer )[\w -]+), '\1[FILTERED]').
    gsub(%r((client_id=|Client-Id:)[\w -]+), '\1[FILTERED]\2').
    gsub(%r((client_secret=|Client-Secret:)[\w -]+), '\1[FILTERED]\2').
    gsub(%r((access_token\":\")[^\"]*), '\1[FILTERED]').
    gsub(%r((publicKey\":\")[^\"]*), '\1[FILTERED]')
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/active_merchant/billing/gateways/alelo.rb', line 41

def supports_scrubbing?
  true
end