22
33module Adyen
44 class Checkout < Service
5- DEFAULT_VERSION = 68
5+ DEFAULT_VERSION = 70
66
77 def initialize ( client , version = DEFAULT_VERSION )
88 service = "Checkout"
@@ -13,7 +13,7 @@ def initialize(client, version = DEFAULT_VERSION)
1313 ]
1414
1515 with_application_info = [
16- :payment_session ,
16+ :payment_session
1717 ]
1818
1919 super ( client , version , service , method_names , with_application_info )
@@ -42,7 +42,7 @@ def payment_links(*args)
4242 else
4343 action = "paymentLinks"
4444 args [ 1 ] ||= { } # optional headers arg
45- @client . call_adyen_api ( @service , action , args [ 0 ] , args [ 1 ] , @version , true )
45+ @client . call_adyen_api ( @service , action , args [ 0 ] , args [ 1 ] , @version )
4646 end
4747 end
4848
@@ -75,6 +75,10 @@ def apple_pay
7575 def modifications
7676 @modifications ||= Adyen ::Modifications . new ( @client , @version )
7777 end
78+
79+ def stored_payment_methods
80+ @stored_payment_methods ||= Adyen ::StoredPaymentMethods . new ( @client , @version )
81+ end
7882 end
7983
8084 class CheckoutDetail < Service
@@ -93,6 +97,16 @@ def result(request, headers = {})
9397 action = "payments/result"
9498 @client . call_adyen_api ( @service , action , request , headers , @version )
9599 end
100+
101+ def donations ( request , headers = { } )
102+ action = "donations"
103+ @client . call_adyen_api ( @service , action , request , headers , @version )
104+ end
105+
106+ def card_details ( request , headers = { } )
107+ action = "cardDetails"
108+ @client . call_adyen_api ( @service , action , request , headers , @version )
109+ end
96110 end
97111
98112 class CheckoutLink < Service
@@ -104,12 +118,12 @@ def initialize(client, version = DEFAULT_VERSION)
104118
105119 def get ( linkId , headers = { } )
106120 action = { method : 'get' , url : "paymentLinks/" + linkId }
107- @client . call_adyen_api ( @service , action , { } , headers , @version , true )
121+ @client . call_adyen_api ( @service , action , { } , headers , @version )
108122 end
109123
110124 def update ( linkId , request , headers = { } )
111125 action = { method : 'patch' , url : "paymentLinks/" + linkId }
112- @client . call_adyen_api ( @service , action , request , headers , @version , false )
126+ @client . call_adyen_api ( @service , action , request , headers , @version )
113127 end
114128 end
115129
@@ -161,12 +175,12 @@ def initialize(client, version = DEFAULT_VERSION)
161175
162176 def capture ( linkId , request , headers = { } )
163177 action = "payments/" + linkId + "/captures"
164- @client . call_adyen_api ( @service , action , request , headers , @version , false )
178+ @client . call_adyen_api ( @service , action , request , headers , @version )
165179 end
166180
167181 def cancel ( linkId , request , headers = { } )
168182 action = "payments/" + linkId + "/cancels"
169- @client . call_adyen_api ( @service , action , request , headers , @version , false )
183+ @client . call_adyen_api ( @service , action , request , headers , @version )
170184 end
171185
172186 def genericCancel ( request , headers = { } )
@@ -176,17 +190,35 @@ def genericCancel(request, headers = {})
176190
177191 def refund ( linkId , request , headers = { } )
178192 action = "payments/" + linkId + "/refunds"
179- @client . call_adyen_api ( @service , action , request , headers , @version , false )
193+ @client . call_adyen_api ( @service , action , request , headers , @version )
180194 end
181195
182196 def reversal ( linkId , request , headers = { } )
183197 action = "payments/" + linkId + "/reversals"
184- @client . call_adyen_api ( @service , action , request , headers , @version , false )
198+ @client . call_adyen_api ( @service , action , request , headers , @version )
185199 end
186200
187201 def amountUpdate ( linkId , request , headers = { } )
188202 action = "payments/" + linkId + "/amountUpdates"
189- @client . call_adyen_api ( @service , action , request , headers , @version , false )
203+ @client . call_adyen_api ( @service , action , request , headers , @version )
204+ end
205+ end
206+
207+ class StoredPaymentMethods < Service
208+ def initialize ( client , version = DEFAULT_VERSION )
209+ @service = "Checkout"
210+ @client = client
211+ @version = version
212+ end
213+
214+ def get ( query_array = { } , headers = { } )
215+ action = { method : 'get' , url : "storedPaymentMethods" + create_query_string ( query_array ) }
216+ @client . call_adyen_api ( @service , action , { } , headers , @version )
217+ end
218+
219+ def delete ( recurringId , query_array = { } , headers = { } )
220+ action = { method : 'delete' , url : "storedPaymentMethods/%s" % recurringId + create_query_string ( query_array ) }
221+ @client . call_adyen_api ( @service , action , { } , headers , @version )
190222 end
191223 end
192- end
224+ end
0 commit comments