Class: Adyen::Checkout

Inherits:
Service show all
Defined in:
lib/adyen/services/checkout.rb

Constant Summary collapse

DEFAULT_VERSION =
50

Instance Attribute Summary

Attributes inherited from Service

#service, #version

Instance Method Summary collapse

Methods inherited from Service

action_for_method_name

Constructor Details

#initialize(client, version = DEFAULT_VERSION) ⇒ Checkout

Returns a new instance of Checkout.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/adyen/services/checkout.rb', line 7

def initialize(client, version = DEFAULT_VERSION)
  service = "Checkout"
  method_names = [
    :payment_methods,
    :payment_session,
    :payment_links,
  ]
  with_application_info = [
    :payment_session,
    :payment_links,
  ]

  super(client, version, service, method_names, with_application_info)
end

Instance Method Details

#payments(*args) ⇒ Object

This method can’t be dynamically defined because it needs to be both a method and a class to enable payments() and payments.detail(), which is accomplished via an argument length checker and the CheckoutDetail class below



27
28
29
30
31
32
33
34
35
36
# File 'lib/adyen/services/checkout.rb', line 27

def payments(*args)
  case args.size
  when 0
    Adyen::CheckoutDetail.new(@client, @version)
  else
    action = "payments"
    args[1] ||= {}  # optional headers arg
    @client.call_adyen_api(@service, action, args[0], args[1], @version, true)
  end
end