Class: Adyen::Payment

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

Constant Summary collapse

DEFAULT_VERSION =
68

Instance Attribute Summary collapse

Attributes inherited from Service

#create_query_string

Instance Method Summary collapse

Methods inherited from Service

action_for_method_name

Constructor Details

#initialize(client, version = DEFAULT_VERSION) ⇒ Payment

Returns a new instance of Payment.



9
10
11
12
13
# File 'lib/adyen/services/payment.rb', line 9

def initialize(client, version = DEFAULT_VERSION)
  @service = "Payment"
  @client = client
  @version = version
end

Instance Attribute Details

#serviceObject

Returns the value of attribute service.



6
7
8
# File 'lib/adyen/services/payment.rb', line 6

def service
  @service
end

#versionObject

Returns the value of attribute version.



6
7
8
# File 'lib/adyen/services/payment.rb', line 6

def version
  @version
end

Instance Method Details

#adjust_authorisation(request, headers: {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/adyen/services/payment.rb', line 15

def adjust_authorisation(request, headers: {} )
  """
  Change the authorised amount
  """
  endpoint = "/adjustAuthorisation".gsub(/{.+?}/, '%s') 
  endpoint = endpoint.gsub(/^\//, "")
  endpoint = endpoint % []
  
  action = { method: "post", url: endpoint}
  @client.call_adyen_api(@service, action, request, headers, @version)
end

#authorise(request, headers: {}) ⇒ Object



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

def authorise(request, headers: {} )
  """
  Create an authorisation
  """
  endpoint = "/authorise".gsub(/{.+?}/, '%s') 
  endpoint = endpoint.gsub(/^\//, "")
  endpoint = endpoint % []
  
  action = { method: "post", url: endpoint}
  @client.call_adyen_api(@service, action, request, headers, @version)
end

#authorise3d(request, headers: {}) ⇒ Object



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

def authorise3d(request, headers: {} )
  """
  Complete a 3DS authorisation
  """
  endpoint = "/authorise3d".gsub(/{.+?}/, '%s') 
  endpoint = endpoint.gsub(/^\//, "")
  endpoint = endpoint % []
  
  action = { method: "post", url: endpoint}
  @client.call_adyen_api(@service, action, request, headers, @version)
end

#authorise3ds2(request, headers: {}) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/adyen/services/payment.rb', line 51

def authorise3ds2(request, headers: {} )
  """
  Complete a 3DS2 authorisation
  """
  endpoint = "/authorise3ds2".gsub(/{.+?}/, '%s') 
  endpoint = endpoint.gsub(/^\//, "")
  endpoint = endpoint % []
  
  action = { method: "post", url: endpoint}
  @client.call_adyen_api(@service, action, request, headers, @version)
end

#cancel(request, headers: {}) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/adyen/services/payment.rb', line 63

def cancel(request, headers: {} )
  """
  Cancel an authorisation
  """
  endpoint = "/cancel".gsub(/{.+?}/, '%s') 
  endpoint = endpoint.gsub(/^\//, "")
  endpoint = endpoint % []
  
  action = { method: "post", url: endpoint}
  @client.call_adyen_api(@service, action, request, headers, @version)
end

#cancel_or_refund(request, headers: {}) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/adyen/services/payment.rb', line 75

def cancel_or_refund(request, headers: {} )
  """
  Cancel or refund a payment
  """
  endpoint = "/cancelOrRefund".gsub(/{.+?}/, '%s') 
  endpoint = endpoint.gsub(/^\//, "")
  endpoint = endpoint % []
  
  action = { method: "post", url: endpoint}
  @client.call_adyen_api(@service, action, request, headers, @version)
end

#capture(request, headers: {}) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
# File 'lib/adyen/services/payment.rb', line 87

def capture(request, headers: {} )
  """
  Capture an authorisation
  """
  endpoint = "/capture".gsub(/{.+?}/, '%s') 
  endpoint = endpoint.gsub(/^\//, "")
  endpoint = endpoint % []
  
  action = { method: "post", url: endpoint}
  @client.call_adyen_api(@service, action, request, headers, @version)
end


99
100
101
102
103
104
105
106
107
108
109
# File 'lib/adyen/services/payment.rb', line 99

def donate(request, headers: {} )
  """
  Create a donation
  """
  endpoint = "/donate".gsub(/{.+?}/, '%s') 
  endpoint = endpoint.gsub(/^\//, "")
  endpoint = endpoint % []
  
  action = { method: "post", url: endpoint}
  @client.call_adyen_api(@service, action, request, headers, @version)
end

#get_authentication_result(request, headers: {}) ⇒ Object



111
112
113
114
115
116
117
118
119
120
121
# File 'lib/adyen/services/payment.rb', line 111

def get_authentication_result(request, headers: {} )
  """
  Get the 3DS authentication result
  """
  endpoint = "/getAuthenticationResult".gsub(/{.+?}/, '%s') 
  endpoint = endpoint.gsub(/^\//, "")
  endpoint = endpoint % []
  
  action = { method: "post", url: endpoint}
  @client.call_adyen_api(@service, action, request, headers, @version)
end

#refund(request, headers: {}) ⇒ Object



123
124
125
126
127
128
129
130
131
132
133
# File 'lib/adyen/services/payment.rb', line 123

def refund(request, headers: {} )
  """
  Refund a captured payment
  """
  endpoint = "/refund".gsub(/{.+?}/, '%s') 
  endpoint = endpoint.gsub(/^\//, "")
  endpoint = endpoint % []
  
  action = { method: "post", url: endpoint}
  @client.call_adyen_api(@service, action, request, headers, @version)
end

#retrieve3ds2_result(request, headers: {}) ⇒ Object



135
136
137
138
139
140
141
142
143
144
145
# File 'lib/adyen/services/payment.rb', line 135

def retrieve3ds2_result(request, headers: {} )
  """
  Get the 3DS2 authentication result
  """
  endpoint = "/retrieve3ds2Result".gsub(/{.+?}/, '%s') 
  endpoint = endpoint.gsub(/^\//, "")
  endpoint = endpoint % []
  
  action = { method: "post", url: endpoint}
  @client.call_adyen_api(@service, action, request, headers, @version)
end

#technical_cancel(request, headers: {}) ⇒ Object



147
148
149
150
151
152
153
154
155
156
157
# File 'lib/adyen/services/payment.rb', line 147

def technical_cancel(request, headers: {} )
  """
  Cancel an authorisation using your reference
  """
  endpoint = "/technicalCancel".gsub(/{.+?}/, '%s') 
  endpoint = endpoint.gsub(/^\//, "")
  endpoint = endpoint % []
  
  action = { method: "post", url: endpoint}
  @client.call_adyen_api(@service, action, request, headers, @version)
end

#void_pending_refund(request, headers: {}) ⇒ Object



159
160
161
162
163
164
165
166
167
168
169
# File 'lib/adyen/services/payment.rb', line 159

def void_pending_refund(request, headers: {} )
  """
  Cancel an in-person refund
  """
  endpoint = "/voidPendingRefund".gsub(/{.+?}/, '%s') 
  endpoint = endpoint.gsub(/^\//, "")
  endpoint = endpoint % []
  
  action = { method: "post", url: endpoint}
  @client.call_adyen_api(@service, action, request, headers, @version)
end