Class: Adyen::Checkout

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

Constant Summary collapse

DEFAULT_VERSION =
70

Instance Attribute Summary

Attributes inherited from Service

#service, #version

Instance Method Summary collapse

Methods inherited from Service

action_for_method_name, #create_query_string

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_session,
    :origin_keys,
    :sessions
  ]

  with_application_info = [
    :payment_session
  ]

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

Instance Method Details

#apple_payObject



71
72
73
# File 'lib/adyen/services/checkout.rb', line 71

def apple_pay
  @apple_pay ||= Adyen::CheckoutApplePay.new(@client, @version)
end

#modificationsObject



75
76
77
# File 'lib/adyen/services/checkout.rb', line 75

def modifications
  @modifications ||= Adyen::Modifications.new(@client, @version)
end

#orders(*args) ⇒ Object



60
61
62
63
64
65
66
67
68
69
# File 'lib/adyen/services/checkout.rb', line 60

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


38
39
40
41
42
43
44
45
46
47
# File 'lib/adyen/services/checkout.rb', line 38

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

#payment_methods(*args) ⇒ Object



49
50
51
52
53
54
55
56
57
58
# File 'lib/adyen/services/checkout.rb', line 49

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

#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

#stored_payment_methodsObject



79
80
81
# File 'lib/adyen/services/checkout.rb', line 79

def stored_payment_methods
  @stored_payment_methods ||= Adyen::StoredPaymentMethods.new(@client, @version)
end