Class: PaymentMethod::Mercadopago

Inherits:
PaymentMethod
  • Object
show all
Defined in:
app/models/spree/payment_method/mercadopago.rb

Instance Method Summary collapse

Instance Method Details

#actionsObject



40
41
42
# File 'app/models/spree/payment_method/mercadopago.rb', line 40

def actions
  %w[void]
end

#auto_capture?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'app/models/spree/payment_method/mercadopago.rb', line 30

def auto_capture?
  false
end

#can_void?(payment) ⇒ Boolean

Admin options

Returns:

  • (Boolean)


36
37
38
# File 'app/models/spree/payment_method/mercadopago.rb', line 36

def can_void?(payment)
  payment.state != 'void'
end

#payment_profiles_supported?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'app/models/spree/payment_method/mercadopago.rb', line 9

def payment_profiles_supported?
  false
end

#provider(additional_options = {}) ⇒ Object



17
18
19
20
21
22
23
24
# File 'app/models/spree/payment_method/mercadopago.rb', line 17

def provider(additional_options = {})
  @provider ||= begin
                  options = { sandbox: preferred_sandbox }
                  client = provider_class.new(self, options.merge(additional_options))
                  client.authenticate
                  client
                end
end

#provider_classObject



13
14
15
# File 'app/models/spree/payment_method/mercadopago.rb', line 13

def provider_class
  ::Mercadopago::Client
end

#source_required?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'app/models/spree/payment_method/mercadopago.rb', line 26

def source_required?
  false
end

#void(*_args) ⇒ Object



44
45
46
# File 'app/models/spree/payment_method/mercadopago.rb', line 44

def void(*_args)
  ActiveMerchant::Billing::Response.new(true, '', {}, {})
end